Hello guys!
I am trying to plot Candlestick and Scatter.
Scatter can work , but the Candlestick canβt see.
When click Animation
Thanks for your help!
import plotly.graph_objects as go
import numpy as np
from plotly.subplots import make_subplots
import pandas as pd
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv')
fig = make_subplots(rows=1, cols=2, horizontal_spacing=0.1)
fig.add_trace(go.Candlestick(x=df['Date'],
open=df['AAPL.Open'],
high=df['AAPL.High'],
low=df['AAPL.Low'],
close=df['AAPL.Close']), row=1, col=1)
fig.add_trace(go.Scatter(x=np.arange(10),
y=1+3*np.random.rand(10),
marker_size=6), row=1, col=2) #trace of index 2
frames =[go.Frame(data=[ go.Candlestick(visible=True),
go.Scatter(y=2+3*np.random.rand(10))
],
traces=[0,1]
) for k in range(10)] # define 20 frames
fig.frames=frames
button = dict(
label='Play',
method='animate',
args=[None, dict(frame=dict(duration=50, redraw=False),
transition=dict(duration=0),
fromcurrent=True,
mode='immediate')])
fig.update_layout(updatemenus=[dict(type='buttons',
showactive=False,
buttons=[button] )
],
width=800, height=500)
fig.update_layout(yaxis2_range=[0, 5.5], yaxis2_autorange=False)