numpy - Logarithmic multi-sequenz plot with equal bar widths -


i have like

import matplotlib.pyplot plt import numpy np  a=[0.05, 0.1, 0.2, 1, 2, 3] plt.hist((a*2, a*3), bins=[0, 0.1, 1, 10]) plt.gca().set_xscale("symlog", linthreshx=0.1) plt.show() 

which gives me following plot: log histogram

as 1 can see, bar width not equal. in linear part (from 0 0.1), find, after this, bar width still in linear scale, while axis in logarithmic scale, giving me uneven widths bars , spaces in between (the tick not in middle of bars).

is there way correct this?

you use histtype='stepfilled' if okay plot data sets plotted 1 behind other. of course, you'll need choose colors alpha values, data can still seen...

a = [0.05, 0.1, 0.2, 1, 2, 3] * 2 b = [0.05, 0.05, 0.05, 0.15, 0.15, 2] colors = [(0.2, 0.2, 0.9, 0.5), (0.9, 0.2, 0.2, 0.5)]  # rgba tuples plt.hist((a, b), bins=[0, 0.1, 1, 10], histtype='stepfilled', color=colors) plt.gca().set_xscale("symlog", linthreshx=0.1) plt.show() 

i've changed data better illustration. gives me: results

for reason overlap color seems going wrong (matplotlib 1.3.1 python 3.4.0; bug?), it's 1 possible solution/alternative problem.


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -