Plot Single Candlestick using plotly

How can I plot a single candlestick given data as

Input
high , open , low , close
[ 18009.800781 , 18004.019571 , 17970.900391 , 17978.850098]

Output as :
image

Candlestick has a vertical position. A single one can be defined as follows:

import plotly.graph_objects as go
fig= go.Figure(go.Candlestick(
    x=[0],
    open=[18004.019571], high=[18009.800781],
    low=[17970.900391], close=[17978.850098]))
fig.update_layout(width=200, height=400, template="plotly_white", 
                  xaxis_rangeslider_visible=False, xaxis_visible=False, yaxis_visible=False)

Save this image as:

fig.write_image("candlestickv.png", width=200, height=400, scale=1)

candlestickv

and with a tool for rotating images, rotate it to get:
candlestick-horiz

1 Like

thanks it helped ; can somone look into this query as well

Unfortunately go.Candlestick has no attribute that allows setting its width.