I was trying to make an OHLC chart using plotly and I am successfully able to do it.I am using Yfinance library to get the data and plotting an OHLC chart for certain stocks. The code that I wrote for it as.
fig = go.Figure(data=go.Ohlc(x=tickerDf.index.date, #tickerDf is the dataframe
open=tickerDf.Open,
high=tickerDf.High,
low=tickerDf.Low,
close=tickerDf.Close))
fig.update_xaxes(showticklabels=False) #Disable xticks
fig.update_layout(width=800,height=600,xaxis=dict(type = "category")) # hide dates with no values
st.plotly_chart(fig)
I was wondering can we widen the middle portion of OHLC graph . Just like image below . My client is forcing me to make this possible and after spending several hours in plotly documentation I didn't find anything .I hope some of you might help me in this. Thanks in advance . If there's any alternative way to achieve this , you can share with me that as well.
You just need to use go.Candlestick
instead of go.Ohlc
. The documentation should link these components together.