我可以创建一个“绘图”图,该图具有一个背景图像和一个整数列表作为xaxis。 这是我的图表:
这是我的代码:
fig.update_layout(
xaxis=dict(
title='Date',range=['0','10']
),yaxis=dict(
title='Score',images=[
go.layout.Image(
source=encoded_image,xref="x",yref="y",x=0,y=0,sizex=10,sizey=10,sizing="stretch",opacity=0.7,layer="below",xanchor="left",yanchor="bottom"
)
]
)
但是当我将range
中的xaxis=dict(title='Date','10']),
更改为日期列表时,我意识到图像的大小必须由整数固定(我不知道日期列表的整数长度) 。如果我不固定xaxis范围,我将不知道图像sizex