简体   繁体   中英

how to customize hover date info in cufflink iplot?

I am using cufflink iplot. the default hover date info only include month and year. How to include day as well? like (Jan 24 2022, value) instead of (Jan 2022, value) by default? and there is not hovermode keyword. Thanks

import cufflinks as cf
from plotly.offline import iplot  #, init_notebook_mode

df.iplot(asFigure=True, xTitle='Date')

Are you sure that the default hover date info only includes month and year? I tried a simple example and the day appears for me. Are the datetimes in your df of type datetime64[ns] ?

import cufflinks as cf
import pandas as pd
from plotly.offline import iplot

df = pd.DataFrame({'date':['2022-01-01','2022-01-02'],'value':[1,2]})
df['date'] = pd.to_datetime(df['date'])
fig = df.iplot(asFigure=True, x='date', xTitle='Date')
fig.show()

在此处输入图像描述

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