【发布时间】:2021-07-16 16:24:09
【问题描述】:
所以我有一个数据框 (df_prod),其中包含一些 PV 面板每小时发电量的时间序列。我有一个图表,想注释峰值。
我知道如何找到该值,但我不知道如何将峰值发生的日期作为注释的 x 值。我想我需要给它一个字符串,但我不确定。
这不起作用:
for spal in df_prod.columns:
maxvalue = df_prod[spal].max()
fig.add_annotation(
x = df_prod.index[df_prod[spal]==maxvalue], # <--- this ist the problem
y = wert,
text='peak ' + spal + ': ' + str(f'{round(wert): n}') + ' kW',
font={'size': 9} ,
showarrow=True,
arrowhead=3,
xanchor='left',
ax=20,
ay=5,
row=r,
col=c
)
【问题讨论】:
标签: python annotations plotly