Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3a99be8

Browse files
add numpy refactror for errorbar3d example
Co-authored-by: Eric Wieser <[email protected]>
1 parent 3c7c0de commit 3a99be8

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

examples/mplot3d/errorbar3d.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@
1717
x, y, z = np.sin(t), np.cos(3*t), np.sin(5*t)
1818

1919
estep = 15
20-
zuplims = [True if (not i % estep and i // estep % 3 == 0)
21-
else False for i in range(t.size)]
22-
zlolims = [True if (not i % estep and i // estep % 3 == 2)
23-
else False for i in range(t.size)]
20+
i = np.arange(t.size)
21+
zuplims = (i % estep == 0) & (i // estep % 3 == 0)
22+
zlolims = (i % estep == 0) & (i // estep % 3 == 2)
2423

2524
ax.errorbar(x, y, z, 0.2, zuplims=zuplims, zlolims=zlolims, errorevery=estep)
2625

0 commit comments

Comments
 (0)