3 Histograms on one axis - Matplotlib python -
i trying create graph has 3 histograms on 1 axis. want them overlap each different color. insides semi-transparent.
whenever use multiple colors rgb alpha 0.5, colors overlap , create nasty color.
how portray 3 graphs without producing nasty color? still want graphs overlap in same nature, in way aesthetically pleasing. have seen graphs overlap, can still see each histograms color distinctly. thanks
you may use colors call "good graph" follows:
import matplotlib.pyplot plt import numpy np; np.random.seed(42) x1 = np.random.rand(15)*3 x2 = np.random.rayleigh(size=15) x3 = np.random.binomial(3,0.7,size=15) bins= np.linspace(0,4,11) kw = dict(bins=bins, histtype='step', fill=true) plt.hist(x1, fc=(.14,.57,.14,.4), ec=(.14,.57,.14, 1), **kw) plt.hist(x2, fc=(.16,.16,1.0,.4), ec=(.16,.16,1.0, 1), **kw) plt.hist(x3, fc=(1.0,.14,.14,.4), ec=(1.0,.14,.14, 1), **kw) plt.show()
Comments
Post a Comment