小编spe*_*had的帖子

Plotly:如何在 x 轴上仅绘制月份和日期?(忽略年份)

我正在尝试绘制时间序列数据,并希望 x 轴只是月和日。Plotly 要求格式为yyyy-mm-dd,但我有几年内数据集的每日平均值,所以我只想mm-dd在 x 轴上绘图。当我发送一个日期时间时,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)
Run Code Online (Sandbox Code Playgroud)

python plotly jupyter jupyter-notebook

6
推荐指数
2
解决办法
6332
查看次数

标签 统计

jupyter ×1

jupyter-notebook ×1

plotly ×1

python ×1