[英]Matplotlib: How do I have the xtick labels apear on the other side of the x-axis?
you can set the y
location of the ticks when you call set_xticklabels
. 您可以在调用
set_xticklabels
时设置刻度线的y
位置。 So, if you set y
to something small but positive, it should be placed inside the bars. 因此,如果将
y
设置为小而正的值,则应将其放置在小节内。
For example: 例如:
import matplotlib.pyplot as 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 the following plot: 产生以下图:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.