Hi all,
I'm trying to plot a distribution using bar() but when I'm setting the left variable to as a sequence of float some of the bar look weird.
When I replace this sequence by a sequence of int it works fines
Does anybody know why this happens and how I can fix it?
Here is the code I'm using:
if __name__=="__main__":
bins=[0.0, 0.02, 0.04, 0.06, 0.08, 0.1, 0.12, 0.14, 0.16,
0.18, 0.2, 0.22, 0.24, 0.26, 0.28, 0.30, 0.32, 0.34,
0.36, 0.38, 0.40, 0.42, 0.44, 0.46, 0.48, 0.5, 0.52,
0.54, 0.56, 0.58, 0.60, 0.62, 0.64, 0.66, 0.68, 0.70,
0.72, 0.74, 0.76, 0.78, 0.80, 0.82, 0.84, 0.86, 0.88,
0.90, 0.92, 0.94, 0.96, 0.98, 1.0]
height=[89775, 1665, 1791, 1695, 1467, 1395, 1306, 1169,
1252, 1134, 1190, 1117, 1018, 995, 1055, 904, 960,
886, 810, 821, 829, 763, 766, 857, 737, 862, 724,
852, 742, 644, 733, 679, 630, 672, 665, 659, 663,
653, 657, 700, 731, 721, 699, 871, 837, 913, 940,
966, 1028, 159774, 40002]
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
plt.bar(bins, height)
plt.show()
Tim
···
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.