You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Shapes seem buggy when displayed on a time series plot with axis type set to 'category' while it is working as expected when set to 'auto' (date index).
If you zoom on the shape, you will clearly see that it is not what you intended to plot: it draws a rectangle instead of a vertical line in the case below. I have encountered that problem with different index format (datetime, integer, string) displayed as 'category'
importpandasaspdimportplotly.graph_objsasgofromplotly.offlineimportiplot, init_notebook_modefromdatetimeimportdatetimedf=pd.read_csv("https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv")
data= [
go.Scatter(
x=df.Date,
y=df['AAPL.Close']
)
]
layout=go.Layout(
xaxis=dict(
type='category', # change this option to _auto_ for a correct shape
),
shapes=[
dict(
x0=datetime(2015, 11, 5),
y0=min(df['AAPL.Close']),
x1=datetime(2015, 11, 5), # x1 = x0 for a vertical liney1=max(df['AAPL.Close'])
)
]
)
fig=go.Figure(data=data, layout=layout)
iplot(fig)
Ouput:
Zoom on the vertical line:
The text was updated successfully, but these errors were encountered:
Hi there,
Thanks for reporting this issue! It's actually in our underlying javascript library so I've opened an issue in that repo. I will close this issue in favour of: plotly/plotly.js#1720, once that's resolved, you will no longer see the problem with our python api.
Shapes seem buggy when displayed on a time series plot with axis type set to
'category'
while it is working as expected when set to'auto'
(date index).If you zoom on the shape, you will clearly see that it is not what you intended to plot: it draws a rectangle instead of a vertical line in the case below. I have encountered that problem with different index format (datetime, integer, string) displayed as
'category'
Ouput:

Zoom on the vertical line:

The text was updated successfully, but these errors were encountered: