我用下面的代码做了一个折线图,我想在y=1处添加一条水平线。我试着按照plotly网站上的说明操作,但还是没有显示。有谁知道原因吗?
date = can_tot_df.date
growth_factor = can_tot_df.growth_factor
trace0 = go.Scatter(
x=date,
y=growth_factor,
mode = 'lines',
name = 'growth_factor'
fig = go.Figure()
fig.add_shape(
type='line',
x0=date.min(),
y0=1,
x1=date.max(),
y1=1,
line=dict(
color='Red',
data = [trace0]
iplot(data)