Example:
#!/usr/bin/env python3# -*- coding: utf-8 -*-importnumpyasnpimportpandasaspdimportplotly.graph_objsasgoimportplotly.offlineaspyimportdatetimen=20open=2+np.abs(np.random.randn(n))
high=open+1low=open-1close=open+np.random.randn(n)
df=pd.DataFrame(
{
'open': open,
'high': high,
'low': low,
'close': close
},
index=pd.date_range(
'2010-01-01',
pd.to_datetime('2010-01-01') +datetime.timedelta(days=n-1)))
hovertext= []
foriinrange(len(df.open)):
hovertext.append('Point'+str(i))
trace=go.Candlestick(
x=df.index,
open=df.open,
high=df.high,
low=df.low,
close=df.close,
text=hovertext,
hoverinfo='all')
data= [trace]
py.plot(data, filename='ohlc_custom_hover.html')However, turning the line trace = go.Candlestick( to trace = go.Ohlc( works just fine.
The plotly version is 2.2.3.
Example:
However, turning the line
trace = go.Candlestick(totrace = go.Ohlc(works just fine.The plotly version is
2.2.3.