python - Editing the x-axis tick labels of a stacked bar graph in matplotlib -


i have written code produce stacked bar graph plots 192 bars of data. data spans on 4 days, , each bar represents 30 minute time period.

the graph produces 192 tick labels overlap each other undesirable appearance-wise.

to fix this, have added following lines code:

myfmt = mdates.dateformatter('%d')
ax.xaxis.set_major_formatter(myfmt)

i want have 1 tick label each day, matplotlib automatically generates unwanted, tick labels when graph spans on 4 days or less. problem doesn't happen when there 5 or more days. there way can force graph have 1 tick each day?

enter image description here

you need use proper locator:

ax.xaxis.set_major_locator(matplotlib.dates.daylocator()) 

(doc)


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -