10000 Update examples/shapes_and_collections/hatches_styles.py · matplotlib/matplotlib@f8aaa68 · GitHub
[go: up one dir, main page]

Skip to content

Commit f8aaa68

Browse files
< 1008E div class="d-flex flex-column gap-2 width-full">
forrestmQuLogic
andauthored
Update examples/shapes_and_collections/hatches_styles.py
Using zip within for loop to make code more understandable. Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
1 parent 84328ff commit f8aaa68

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/shapes_and_collections/hatches_styles.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020

2121
hashes = ['/', '\\', '|', '-', '+', 'x', 'o', 'O', '.', '*']
2222

23-
for h in range(len(hashes)):
24-
ax.add_patch(Rectangle(pos[h], 2, 2, fill=False, hatch=hashes[h]))
25-
ax.text(text_pos[h][0], text_pos[h][1], hashes[h], fontsize=15)
23+
for h, p, t in zip(hashes, pos, text_pos):
24+
ax.add_patch(Rectangle(p, 2, 2, fill=False, hatch=h))
25+
ax.text(t[0], t[1], h, fontsize=15)
2626

2727
plt.axis('equal')
2828
plt.axis('off')

0 commit comments

Comments
 (0)
0