Hi all.

I want to have dates as major ticks labels of X axis.
This fragment of code works fine except that I need more dates to appear instead the 6 I am getting. The number of dates in dtsd is for ex. 262.

Thanks for any help.

BTW, I got most of this code from some site on the internet.

...
fig=plt.figure(figsize=(12,9))
gs=gridspec.GridSpec(2,1,height_ratios=[4,1])
...
ax0=plt.subplot(gs[0])
...
plt.xlim(-0.1,dts[-1]+0.1)
dtsd=pd.to_datetime(ds.getIndexes())
def format_date(x,__pos=None):
  thisind=np.clip(int(x+0.5),0,dtslen-1)
  return dtsd[thisind].strftime('%Y-%m-%d')
ax0.xaxis.set_major_formatter(ticker.FuncFormatter(format_date))
fig.autofmt_xdate()
...

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to