histogram - How to remove the over x line in pylab (python)? -
how remove on line after banana histogram can stick vertical line?
import matplotlib matplotlib.use('svg') pylab import* label = ['apple','orange', 'banana'] number = [5,4,3] barwidth =0.5 bar_location= range(len(number)) bar(bar_location,number,width=barwidth) xlim(0-barwidth,len(number)) xticks([ + barwidth/2 in bar_location], label) tittle('fruits') xlabel('my_fruit') ylabel('number') savefig('fruits.svg') show()
you can set range of x-axis xlim(), e.g.:
xlim(0 - barwidth, len(number) - 0.5)
(but make sure insert before savfig()).
Comments
Post a Comment