# Plot Single Candlestick using plotly

**URL:** <https://community.plotly.com/t/plot-single-candlestick-using-plotly/69798>\
**Category:** 📊 Plotly Python\
**Created:** [November 10, 2022, 2:53pm UTC](https://community.plotly.com/t/plot-single-candlestick-using-plotly/69798 "2022-11-10T14:53:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yogi\_dhiman](https://avatars.discourse-cdn.com/v4/letter/y/f04885/32.png) [@yogi\_dhiman](https://community.plotly.com/u/yogi_dhiman)\
**Post date:** [November 10, 2022, 2:53pm UTC](https://community.plotly.com/t/plot-single-candlestick-using-plotly/69798/1 "2022-11-10T14:53:43Z")

</div>

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](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/8/3/83d00476058ed8e37e2eef5f2c983ceccc33c1f6.png)

---

<div class="post-metadata">

**Author:** ![empet](https://avatars.discourse-cdn.com/v4/letter/e/977dab/32.png) [@empet](https://community.plotly.com/u/empet)\
**Post date:** [November 12, 2022, 8:11am UTC](https://community.plotly.com/t/plot-single-candlestick-using-plotly/69798/2 "2022-11-12T08:11:23Z")

</div>

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

```auto
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:

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

```

![candlestickv](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/e/1/e182fb617da8f73b182f61490bfaaad9d93a0e2b.png)

and with a tool for rotating images, rotate it to get:  
 ![candlestick-horiz](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/9/5/95fc8afa2ffe106c9c82aad8e582608f3d971281.png)

---

<div class="post-metadata">

**Author:** ![yogi\_dhiman](https://avatars.discourse-cdn.com/v4/letter/y/f04885/32.png) [@yogi\_dhiman](https://community.plotly.com/u/yogi_dhiman)\
**Post date:** [November 12, 2022, 1:06pm UTC](https://community.plotly.com/t/plot-single-candlestick-using-plotly/69798/3 "2022-11-12T13:06:09Z")

</div>

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

> [@Can i set the width of individual candlesticks boxes?](https://community.plotly.com/t/can-i-set-the-width-of-individual-candlesticks-boxes/40812):
>
> In my application, i plot trading data in a candlesticks chart against cumulative volume on the x-axis, not time. It would look better visually if i can also set the width of the boxes accordingly. Is this possible?

---

<div class="post-metadata">

**Author:** ![empet](https://avatars.discourse-cdn.com/v4/letter/e/977dab/32.png) [@empet](https://community.plotly.com/u/empet)\
**Post date:** [November 13, 2022, 8:00am UTC](https://community.plotly.com/t/plot-single-candlestick-using-plotly/69798/4 "2022-11-13T08:00:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![yogi\_dhiman](https://avatars.discourse-cdn.com/v4/letter/y/f04885/32.png) [@yogi\_dhiman](https://community.plotly.com/u/yogi_dhiman)\
**Post date:** [November 13, 2022, 4:41pm UTC](https://community.plotly.com/t/plot-single-candlestick-using-plotly/69798/5 "2022-11-13T16:41:59Z")

</div>

> [@How to add a horizontal scroll to a plot with 100 of Candlesticks ( can display first 10 )](https://community.plotly.com/t/how-to-add-a-horizontal-scroll-to-a-plot-with-100-of-candlesticks-can-display-first-10/69839):
>
> How to add a horizontal scroll to a plot with 100 of Candlesticks for vidx, (xd, yad, aclr, ytd, tclr, asr) in enumerate(zip(x\_data, a\_data, a\_colors, t\_data, t\_colors, ysr)): boxplot\_fig.add\_trace(go.Candlestick(x=[x\_data[vidx]],open=[yad[1]], high=[yad[0]],low=[yad[2]], close=[yad[3]])) Note My x axis are characters not index
