# Error in an histogram

Since I have solved my problem I give the code and ask how to print only one time the 0 or multiple occurences of a number. Of course it will be possible to remove all the zero of y less one but I would prefer to incorporate this in the function.

def my_histo(l, ll,couleur='skyblue',bord='red',montext="$ABC$",rapport='automatic',ajust=5000,politail=5):
A=sum(plot(polygon([(l[j],0),(l[j],ll[j]),(l[j+1],ll[j]),(l[j+1],0)],color=couleur,
edgecolor=bord)) for j in range(len(l)-1))
B=plot(polygon([(l[len(l)-2],0),(l[len(l)-2],ll[len(ll)-1]),(l[len(l)-1],ll[len(ll)-1]),(l[len(l)-1],0)],color=couleur,
edgecolor=bord))
T = text(montext,((min(l)+max(l))/2,ajust))
return show(A+B+T,aspect_ratio=rapport,ticks=[l,ll],fontsize=politail)
my_histo(list(X), list(Vtc[0]),couleur='skyblue',bord='red')

y=list([7301.06,  2887.38, 429.70, 1104.18, 773.924, 0.000000, 0.000000, 0.000000,
0.000000, 0.000000, 1828.35, 1921.33, 0.000000, 0.000000,  0.000000, 0.000000,
0.000000, 0.000000,0.000000, 3395.03])


and

x = [75.6750, 251.025, 426.375, 601.725, 777.075, 952.425,  1127.78, 1303.12, 1478.48,
1653.83, 1829.18, 2004.53, 2179.88, 2355.23, 2530.58, 2705.93, 2881.28, 3056.62, 3231.98, 3407.33]


my_histo(x, y, couleur='skyblue',bord='red')

edit retag close merge delete