python - Matplotlib: How do I have the xtick labels apear on the other side of the x-axis? -
in bar chart:
how make x-axis labels appear in bars of bar-chart , left-aligned x-axis?
i tried ax.xaxis.labelpad()
method not seem anything.
you can set y
location of ticks when call set_xticklabels
. so, if set y
small positive, should placed inside bars.
for example:
import matplotlib.pyplot plt fig,ax = plt.subplots(1) ax.bar([0,1,2,3],[7900,9400,8700,9990],facecolor='#5080b0',edgecolor='k',width=0.3) ax.set_xticks([0.15,1.15,2.15,3.15]) ax.set_xticklabels(['beek1','beek2','orbath','kroo'], rotation='vertical',y=0.05,va='bottom')
produces following plot:
Comments
Post a Comment