8000 Clean up zorder example by dstansby · Pull Request #10962 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Clean up zorder example #10962

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 5, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions examples/misc/zorder_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,29 @@

plt.figure()
plt.subplot(211)
plt.plot(x, y, 'r', lw=3)
plt.plot(x, y, 'C3', lw=3)
plt.scatter(x, y, s=120)
plt.title('Lines on top of dots')

# Scatter plot on top of lines
plt.subplot(212)
plt.plot(x, y, 'r', zorder=1, lw=3)
plt.plot(x, y, 'C3', zorder=1, lw=3)
plt.scatter(x, y, s=120, zorder=2)
plt.title('Dots on top of lines')
plt.tight_layout()

###############################################################################
# A new figure, with individually ordered items

x = np.linspace(0, 2*np.pi, 100)
plt.figure()
plt.plot(x, np.sin(x), linewidth=10, color='black', label='zorder=10',
plt.plot(x, np.sin(x), linewidth=10, label='zorder=10',
zorder=10) # on top
plt.plot(x, np.cos(1.3*x), linewidth=10, color='red', label='zorder=1',
plt.plot(x, np.cos(1.3*x), linewidth=10, label='zorder=1',
zorder=1) # bottom
plt.plot(x, np.sin(2.1*x), linewidth=10, color='green', label='zorder=3',
plt.plot(x, np.sin(2.1*x), linewidth=10, label='zorder=3',
zorder=3)
plt.axhline(0, linewidth=10, color='blue', label='zorder=2',
plt.axhline(0, linewidth=10, label='zorder=2',
zorder=2)
plt.title('Custom order of elements')
l = plt.legend()
Expand Down
0