Plotly make great figures. Plotly express can change the scale easely with the parameter "log_y=True". I wonder how can it be done with plotly candlesticks class without changing or altering the original data.
Reviewing documentation, I get lost with so many examples, but cannot find this.
Code to reproduce:
ohlc = np.array([[21318.58 , 21333.63 , 21296.43 , 21306.91 , 198.6474 ],
[21306.92 , 21310.51 , 21216.49 , 21235.99 , 216.02765],
[21235.98 , 21249.64 , 21128.41 , 21204.33 , 495.20652],
[21204.33 , 21238.26 , 21169.69 , 21198.37 , 185.9797 ],
[21198.36 , 21205.54 , 21154. , 21165.01 , 208.91714],
[21165. , 21230. , 21165. , 21229.99 , 130.70106],
[21229.99 , 21280.45 , 21217.32 , 21269.24 , 162.83325],
[21269.24 , 21279.51 , 21250. , 21261.2 , 143.27844],
[21261.21 , 21278.19 , 21260.05 , 21260.66 , 82.78135]])
ohlc = np.reshape(ohlc, (9,5))
df = pd.DataFrame(data=ohlc, columns=['open', 'high', 'low', 'close', 'volume'])
import plotly.graph_objects as go
fig = go.Figure(data=[go.Candlestick(x=df.index,
open=df['open'],
high=df['high'],
low=df['low'],
close=df['close'])])
fig.show()
Tried this:
fig = go.Figure(data=[go.Candlestick(x=df.index,
open=df['open'],
high=df['high'],
low=df['low'],
close=df['close'], log_y=True)])
fig.show()
But... error...
Did you mean "low"?
ValueError: Invalid property specified for object of type plotly.graph_objs.Candlestick: 'log'
...
Bad property path:
log_y
^^^
