# Plotting/Animating a single candlestick

**URL:** https://community.plotly.com/t/plotting-animating-a-single-candlestick/15045
**Category:** 📊 Plotly Python
**Created:** [October 29, 2018, 9:45am UTC](https://community.plotly.com/t/plotting-animating-a-single-candlestick/15045 "2018-10-29T09:45:00Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![DeonOosthuizen](https://avatars.discourse-cdn.com/v4/letter/d/85f322/32.png) [@DeonOosthuizen](https://community.plotly.com/u/DeonOosthuizen)
#### Post date: [October 29, 2018, 9:45am UTC](https://community.plotly.com/t/plotting-animating-a-single-candlestick/15045/1 "2018-10-29T09:45:01Z")

</div>

Hi  
Im using python3.7 with the latest plotly library

using the Sample Code provided by plotly documents how would i change it ore add to it to have it instead of producing  
5 different candles use the data to produce a single candle that changes(animate) with the new values instead of generating a new candle next to previous one

```
import plotly as py
import plotly.graph_objs as go

from datetime import datetime

open_data = [33.0, 33.3, 33.5, 33.0, 34.1]
high_data = [33.1, 33.3, 33.6, 33.2, 34.8]
low_data = [32.7, 32.7, 32.8, 32.6, 32.8]
close_data = [33.0, 32.9, 33.3, 33.1, 33.1]
dates = [datetime(year=2013, month=10, day=11)]

trace = go.Candlestick(x=dates,
                       open=open_data,
                       high=high_data,
                       low=low_data,
                       close=close_data)
data = [trace]
py.offline.plot(data, filename='candlestick_datetime')

```

Kind Regards  
Deon Oosthuizen

---

<div class="post-metadata">

### Author: ![jmmease](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/jmmease/32/3706_2.png) [@jmmease](https://community.plotly.com/u/jmmease)
#### Post date: [October 29, 2018, 10:28am UTC](https://community.plotly.com/t/plotting-animating-a-single-candlestick/15045/2 "2018-10-29T10:28:54Z")

</div>

Hi @DeonOosthuizen,

I think you’re best starting point is going to be the gapminder example ([https://plot.ly/python/animations/#using-a-slider-and-buttons](https://plot.ly/python/animations/#using-a-slider-and-buttons)).

Basically you’ll need to create an array of frames (in layout.frames), where each frame has a single candlestick trace. (In this example, each frame has 5-traces so it’s a bit more complicated that your case needs to be).

Give that a try, and feel free to follow up if you get stuck 🙂

-Jon

---

<div class="post-metadata">

### Author: ![DeonOosthuizen](https://avatars.discourse-cdn.com/v4/letter/d/85f322/32.png) [@DeonOosthuizen](https://community.plotly.com/u/DeonOosthuizen)
#### Post date: [October 29, 2018, 10:50am UTC](https://community.plotly.com/t/plotting-animating-a-single-candlestick/15045/3 "2018-10-29T10:50:09Z")

</div>

Thanks @jmmease

Ill give it look maybe it will work better than what i’m currently trying
