numpy - matplotlib boxplot color -
i'm trying create box & whisker plot of set of data binning y versus x. found useful example in making binned boxplot in matplotlib numpy , scipy in python. question simple. how can specify color of boxes in matplotlib.pyplot.boxplot set transparent in order let reader see original data. know there exists example shown in http://matplotlib.sourceforge.net/examples/pylab_examples/boxplot_demo2.html simpler this? looks strange impossibility set color of boxes directly in boxplot thank in advance
you render original data scatter plot behind boxplot , hide fliers of boxplot.
import pylab import numpy pylab.figure() data = [numpy.random.normal(i, size=50) in xrange(5)] x, y in enumerate(data): pylab.scatter([x + 1 in xrange(50)], y, alpha=0.5, edgecolors='r', marker='+') bp = pylab.boxplot(data) pylab.setp(bp['boxes'], color='black') pylab.setp(bp['whiskers'], color='black') pylab.setp(bp['fliers'], marker='none') pylab.xlim(0,6) pylab.show()
Comments
Post a Comment