Skip to content
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

matplotlib.pyplot.boxplot ignored showmeans keyword #5816

Closed
cswarth opened this issue Jan 8, 2016 · 2 comments
Closed

matplotlib.pyplot.boxplot ignored showmeans keyword #5816

cswarth opened this issue Jan 8, 2016 · 2 comments

Comments

@cswarth
Copy link

cswarth commented Jan 8, 2016

I'm trying to suppress all graphical elements of a boxplot in order to take advantage of the scaling it provides for subsequent point plots. Unless I'm misunderstanding the intent of the showmeans keyword, it appears to not work as advertised.

[edit : wait - that red line is the median, isn't it? showmeans probably doesn't do what I think it does and I need to some other keyword to suppress the red line and the small vertical lines too.]

import sys
import matplotlib.pyplot as plt
import numpy as np
print("python", sys.version)
print("matplotlib version", matplotlib.__version__)
print("numpy version", np.__version__)
# fake up some data
spread = np.random.rand(50) * 100
center = np.ones(25) * 50
flier_high = np.random.rand(10) * 100 + 100
flier_low = np.random.rand(10) * -100
data = np.concatenate((spread, center, flier_high, flier_low), 0)

# basic plot
plt.boxplot(data, showcaps=False, showmeans=False, showbox=False, showfliers=False)

plt.show()

screen shot 2016-01-08 at 3 39 44 pm

@cswarth
Copy link
Author

cswarth commented Jan 9, 2016

Does not look like a bug, just special case. I can suppress the red horizontal line and vertical blue lines through medianprops and whiskerprops, respectively.

import sys
import matplotlib.pyplot as plt
import numpy as np

print("python", sys.version)
print("matplotlib version", matplotlib.__version__)
print("numpy version", np.__version__)

# fake up some data
spread = np.random.rand(50) * 100
center = np.ones(25) * 50
flier_high = np.random.rand(10) * 100 + 100
flier_low = np.random.rand(10) * -100
data = np.concatenate((spread, center, flier_high, flier_low), 0)

# basic plot
props = {'linewidth': 0}
plt.boxplot(data, showcaps=False, showfliers=False, showbox=False,
                  medianprops=props, whiskerprops=props)

plt.show()

screen shot 2016-01-08 at 4 34 33 pm

@cswarth cswarth closed this as completed Jan 9, 2016
@tacaswell
Copy link
Member

It seems there should be an easier way to adjust the limits...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants