When trying to display candlesticks on a y-axis with a lower index than another y-axis, the candlesticks do not show.
import plotly.graph_objects as go import pandas as pd df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv') fig = go.Figure() fig.add_trace(go.Candlestick(x=df['Date'], open=df['AAPL.Open'], high=df['AAPL.High'], low=df['AAPL.Low'], close=df['AAPL.Close'], yaxis='y1') ) fig.add_trace(go.Scattergl(x=df['Date'], y=df['AAPL.Low'], yaxis='y2')) fig.show()
It is peculiar that the xrange slider does still display the trace. I deliberately did not update the y-axes to make everything as simple as possible.
Switching the yaxis names such that the Scatter has
yaxis='y1' and the Candlestick has
yaxis='y2' results in expected behaviour as can be seen here:
However, this solution does not work when displaying multiple candlesticks on separate y-axes, as then all but the last candlestick will not be displayed.
Now there is another workaround to this by using secondary y-axis in
plotly.subplots, but this is limited to only two y-axes and, as far as I know, wouldn’t work for more than two y-axes. Possibly, the bug is related to go.Candlestick with Subplots.