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

Skip to content

axes.boxplot does not have zorder kwarg #7171

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

Closed
nancysendoh opened this issue Sep 24, 2016 · 7 comments
Closed

axes.boxplot does not have zorder kwarg #7171

nancysendoh opened this issue Sep 24, 2016 · 7 comments
Labels
Difficulty: Easy https://matplotlib.org/devdocs/devel/contribute.html#good-first-issues New feature
Milestone

Comments

@nancysendoh
Copy link

Hi eveybody,

I want to draw boxplot and scatter in one figure, but the boxplot always covers the points as below:
1

How could I set the scatter above the boxplot? Thanks ~

Here's my code:

import matplotlib.pyplot as plt
import numpy as np

x=[1,2,3]
a=np.array([70,170,130])
y=[]
yy=[]
for i in range(3):
    yy.append(np.random.randn(5))
    y.append(yy[i].mean())

plt.figure()
fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(5, 5))
axes.scatter(x,y,c='r',s=a)
bplot1 = axes.boxplot(yy,
                     vert=True,   # vertical box aligmnent
                     patch_artist=True)   # fill with color
color = 'blue'
for patch in bplot1['boxes']:
    patch.set_facecolor(color)
    patch.set_alpha(0.5)
plt.savefig('1.jpg',dpi=100)
plt.show()
@nancysendoh nancysendoh changed the title How to set the layer irder? How to set the layer order? Sep 24, 2016
@Phlya
Copy link
Contributor

Phlya commented Sep 24, 2016

Use zorder argument in plotting commands, the higher the value, the more on top will be the objects.

@Kojoley
Copy link
Member

Kojoley commented Sep 24, 2016

Please do not use the issue tracker to ask questions, use mailing list or gitter for this. https://github.com/matplotlib/matplotlib#contact

@Kojoley Kojoley closed this as completed Sep 24, 2016
@nancysendoh
Copy link
Author

thanks a lot! it's very helpful. but it seems the boxplot() doesn't have the zorder argument. So I couldn't set the order of two boxplot?
thanks again!

发自我的小米手机
在 Ilya Flyamer [email protected],2016年9月24日 下午3:53写道:

Use zorder argument in plotting commands, the higher the value, the more on top will be the objects.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com//issues/7171#issuecomment-249351562, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AJwUtAK2JH3QhwFaExArarpu4LXbYtdPks5qtNcNgaJpZM4KFjza.

@tacaswell tacaswell changed the title How to set the layer order? axes.boxplot does not have zorder kwarg Sep 24, 2016
@tacaswell tacaswell added this to the 2.1 (next point release) milestone Sep 24, 2016
@tacaswell tacaswell added the Difficulty: Easy https://matplotlib.org/devdocs/devel/contribute.html#good-first-issues label Sep 24, 2016
@tacaswell tacaswell reopened this Sep 24, 2016
@tacaswell
Copy link
Member

re-titled and re-opened, boxplot should take zorder as a kwrag.

@efiring
Copy link
Member

efiring commented Sep 24, 2016

@nancysendoh, for your immediate problem, try raising the scatter plot by supplying scatter a "zorder=2.5" kwarg. That will put its patch collection above the Line2D default zorder of 2 that is used by boxplot.

@nancysendoh
Copy link
Author

Thanks a lot~![☺]


发件人: Eric Firing [email protected]
发送时间: 2016年9月24日 18:46
收件人: matplotlib/matplotlib
抄送: Cookie; Mention
主题: Re: [matplotlib/matplotlib] axes.boxplot does not have zorder kwarg (#7171)

@nancysendohhttps://github.com/nancysendoh, for your immediate problem, try raising the scatter plot by supplying scatter a "zorder=2.5" kwarg. That will put its patch collection above the Line2D default zorder of 2 that is used by boxplot.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com//issues/7171#issuecomment-249380894, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AJwUtO3s7RZrSOx9KOaUXofIHiQj40_bks5qtW_xgaJpZM4KFjza.

@afvincent
Copy link
Contributor

Closing: the zorder kwarg was added in #7178 :).

@QuLogic QuLogic modified the milestones: 2.0 (style change major release), 2.1 (next point release) Feb 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Difficulty: Easy https://matplotlib.org/devdocs/devel/contribute.html#good-first-issues New feature
Projects
None yet
Development

No branches or pull requests

7 participants