python 中带有标志的阴谋烛台
plotly candlestick in python with flag
我使用 plotly 设置了烛台图表,想知道您是否可以根据包含数字 1 的标志列在该图表的顶部创建一个与烛台重叠的矩形
代码:
import pandas as pd
import plotly.graph_objects as go
df = pd.DataFrame({"data_minu": ['30/10 09:00','30/10 09:05','30/10,09:10','30/10 09:15','30/10 09:20','30/10 09:25','30/10 09:30','30/10 09:35','30/10 09:40','30/10 09:45'],
"Open":['10','17','23','20','8','22','24','25','29','22'],
"High":['21','27','25','29','24','27','28','32','29','25'],
"Low":['6','12','18','9','5','8','24','18','15','10'],
"Close":['17','24','22','10','21','25','26','30','18','10'],
"Flag": ['0','1','1','1','0','1','1','1','0','0']})
fig = go.Figure(data=[go.Candlestick(x=df['data_minu'],
open=df['Open'], high=df['High'],
low=df['Low'], close=df['Close'])
])
fig.update_layout(xaxis_rangeslider_visible=False)
fig.show()
当前结果:
期望结果的大纲:
。 plotly 网站上的人帮我解决了这个问题。我分享他们的答案,并在此基础上进行各种调整。
https://community.plot.ly/t/plotly-candlestick-in-python-with-flag/31154
谢谢。
我使用 plotly 设置了烛台图表,想知道您是否可以根据包含数字 1 的标志列在该图表的顶部创建一个与烛台重叠的矩形
代码:
import pandas as pd
import plotly.graph_objects as go
df = pd.DataFrame({"data_minu": ['30/10 09:00','30/10 09:05','30/10,09:10','30/10 09:15','30/10 09:20','30/10 09:25','30/10 09:30','30/10 09:35','30/10 09:40','30/10 09:45'],
"Open":['10','17','23','20','8','22','24','25','29','22'],
"High":['21','27','25','29','24','27','28','32','29','25'],
"Low":['6','12','18','9','5','8','24','18','15','10'],
"Close":['17','24','22','10','21','25','26','30','18','10'],
"Flag": ['0','1','1','1','0','1','1','1','0','0']})
fig = go.Figure(data=[go.Candlestick(x=df['data_minu'],
open=df['Open'], high=df['High'],
low=df['Low'], close=df['Close'])
])
fig.update_layout(xaxis_rangeslider_visible=False)
fig.show()
当前结果:
期望结果的大纲:
。 plotly 网站上的人帮我解决了这个问题。我分享他们的答案,并在此基础上进行各种调整。
https://community.plot.ly/t/plotly-candlestick-in-python-with-flag/31154
谢谢。