简体   繁体   中英

Matplotlib don't show all ticks/labels with bar chart?

When plotting a line with many points, matplotlib automatically hides some x-axis ticks/labels to make sure all labels can fit.

If I want to plot a bar chat with many points, is there anyway to make matplotlib think of the x-axis in the same as with a line plot? Right now it's trying to squeeze in all the labels.

I would suggest specifiying the list of xtick labels:

plt.xticks([80,150,300]) ### In this case these are numbers, change them to your values 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM