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

Conversation

dstansby
Copy link
Member
@dstansby dstansby commented Apr 5, 2018
  • Add tight layout to the first plot
  • Use the build it colour cycle for colours

@dstansby dstansby added this to the v2.2-doc milestone Apr 5, 2018
@timhoffm
Copy link
Member
timhoffm commented Apr 5, 2018

The overall layout of the second polt could use some additional improvements:
appearence in this PR

  • The curves are quite chaotic and distract from the zorder.
  • The legend is autoplaced to a position where it does not overlap with the data, so the zorder effect is not visible.
  • The axhline has the color C1 (is this a bug?). Anyway, since it has the same color as the first curve, the zorder is indistinguishable.
  • Use rcParams['lines.linewidth'] to declutter the plot args.

I propose this plot:

grafik

x = np.linspace(0, 2*np.pi, 100)
plt.rcParams['lines.linewidth'] = 10
plt.figure()
plt.plot(x, np.sin(x), label='zorder=10', zorder=10)  # on top
plt.plot(x, np.sin(1.1*x), label='zorder=1', zorder=1)  # bottom
plt.plot(x, np.sin(1.2*x), label='zorder=3',  zorder=3)
plt.axhline(0, label='zorder=2', color='grey', zorder=2)
plt.title('Custom order of elements')
l = plt.legend(loc='upper right')
l.set_zorder(20)  # put the legend on top
plt.show()

@timhoffm
Copy link
Member
timhoffm commented Apr 5, 2018

Should the first example be converted to plt.subplots and the OO approach?

@dstansby
Copy link
Member Author
dstansby commented Apr 5, 2018

I'm happy for those to go in another PR, but I just wanted to do a quick clean with this one.

@timhoffm
Copy link
Member
timhoffm commented Apr 5, 2018

Ok. I can do the other stuff in a follow up.

@jklymak jklymak merged commit abe0e39 into matplotlib:master Apr 5, 2018
lumberbot-app bot pushed a commit that referenced this pull request Apr 5, 2018
jklymak added a commit that referenced this pull request Apr 5, 2018
@dstansby dstansby deleted the zorder-demo-clean branch April 6, 2018 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0