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

Skip to content

Commit abe0e39

Browse files
authored
Merge pull request #10962 from dstansby/zorder-demo-clean
Clean up zorder example
2 parents 3c8006f + 10e4c50 commit abe0e39

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

examples/misc/zorder_demo.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,28 +41,29 @@
4141

4242
plt.figure()
4343
plt.subplot(211)
44-
plt.plot(x, y, 'r', lw=3)
44+
plt.plot(x, y, 'C3', lw=3)
4545
plt.scatter(x, y, s=120)
4646
plt.title('Lines on top of dots')
4747

4848
# Scatter plot on top of lines
4949
plt.subplot(212)
50-
plt.plot(x, y, 'r', zorder=1, lw=3)
50+
plt.plot(x, y, 'C3', zorder=1, lw=3)
5151
plt.scatter(x, y, s=120, zorder=2)
5252
plt.title('Dots on top of lines')
53+
plt.tight_layout()
5354

5455
###############################################################################
5556
# A new figure, with individually ordered items
5657

5758
x = np.linspace(0, 2*np.pi, 100)
5859
plt.figure()
59-
plt.plot(x, np.sin(x), linewidth=10, color='black', label='zorder=10',
60+
plt.plot(x, np.sin(x), linewidth=10, label='zorder=10',
6061
zorder=10) # on top
61-
plt.plot(x, np.cos(1.3*x), linewidth=10, color='red', label='zorder=1',
62+
plt.plot(x, np.cos(1.3*x), linewidth=10, label='zorder=1',
6263
zorder=1) # bottom
63-
plt.plot(x, np.sin(2.1*x), linewidth=10, color='green', label='zorder=3',
64+
plt.plot(x, np.sin(2.1*x), linewidth=10, label='zorder=3',
6465
zorder=3)
65-
plt.axhline(0, linewidth=10, color='blue', label='zorder=2',
66+
plt.axhline(0, linewidth=10, label='zorder=2',
6667
zorder=2)
6768
plt.title('Custom order of elements')
6869
l = plt.legend()

0 commit comments

Comments
 (0)