我试图绘制时间序列数据,希望x轴只是月和日。Plotly要求格式为yyyy-mm-dd
,但我有几年来的数据集的日平均值,所以我只想在x轴上绘制mm-dd
。当我发送的日期时间仅仅是mm-dd
时,它假设mm
是年份。我能不能让它绕过一年,只用mm-dd
?在
df_en_ave1.index = df_en_ave1.index.strftime('%m-%d') #convert my index to month and day datetime
trace1=go.Scatter(x=df_en_ave1.index, y=df_en_ave1.evap) #need to bypass year in date here somehow
data = [trace1]
plotly.offline.iplot(data)
请尝试以下方法:
其他格式
^{pr2}$多亏了 https://community.plot.ly/t/how-to-make-the-messy-date-ticks-organized/7477/3
答案:
示例图:
完整代码:
^{pr2}$相关问题 更多 >
编程相关推荐