-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
bugsomething brokensomething broken
Description
This may be an issue in plotlyjs - if so, please point me to the right place.
When plotting data on multiple Y axes, particularly when nothing is plotted on the primary Y axis, sometimes plotly will only show one series.
Example code
# !pip install plotly
import datetime
from numpy import array
import plotly.graph_objs as go
import plotly
print(plotly.__version__) # 3.2.1
go.FigureWidget({
'data': [{'marker': {'color': 'red', 'size': 5, 'symbol': 'circle-open'},
'mode': 'markers',
'name': 'r',
'type': 'scatter',
'uid': 'af705b50-c0ee-11e8-84dc-1208b1a853fd',
'x': array([datetime.datetime(2015, 1, 1, 0, 0),
datetime.datetime(2015, 1, 2, 0, 0),
datetime.datetime(2015, 1, 3, 0, 0),], dtype=object),
'y': [0.43369082538702236, 1.2898213293637133, 0.624430850249652,],
'yaxis': 'y2'},
{'marker': {'color': 'green', 'size': 5, 'symbol': 'circle-open'},
'mode': 'markers',
'name': 'g',
'type': 'scatter',
'uid': 'af705b51-c0ee-11e8-9e48-1208b1a853fd',
'x': array([datetime.datetime(2015, 1, 1, 0, 0),
datetime.datetime(2015, 1, 2, 0, 0),
datetime.datetime(2015, 1, 3, 0, 0),], dtype=object),
'y': [-0.30649578247834386, -1.0464786848889265, 1.911426735783162,],
'yaxis': 'y3'},],
'layout': {'xaxis': {'title': 'Time'},
'yaxis': {'title': 'y axis number one',},
'yaxis2': {'overlaying': 'y',
'title': 'y axis 2'},
'yaxis3': {'overlaying': 'y',
'side': 'right',
'title': 'y axis 3'}}
})
Expected behavior
Two series are plotted
Actual behavior
Two series show up in the legend, but only one series is plotted:
Workaround
If you change 'y2'
in the code above to 'y1
', both series will show up. However, it's not always reasonable to assume there will be data on y1 - I am trying to write a purpose-specific API that uses plotly in such a way that I cannot guarantee there will be something on y1 without significant extra complexity.
Metadata
Metadata
Assignees
Labels
bugsomething brokensomething broken