# Update (not extend) graph data but not layout

**URL:** <https://community.plotly.com/t/update-not-extend-graph-data-but-not-layout/63914>\
**Category:** 📊 Plotly Python\
**Tags:** question\
**Created:** [May 9, 2022, 9:14pm UTC](https://community.plotly.com/t/update-not-extend-graph-data-but-not-layout/63914 "2022-05-09T21:14:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![matinoseda](https://avatars.discourse-cdn.com/v4/letter/m/f07891/32.png) [@matinoseda](https://community.plotly.com/u/matinoseda)\
**Post date:** [May 9, 2022, 9:14pm UTC](https://community.plotly.com/t/update-not-extend-graph-data-but-not-layout/63914/1 "2022-05-09T21:14:30Z")

</div>

Hi!, i want to update a graph with 9 traces evety second with an interval. I don´t want to update de hole figure, just the graph.data. I have seen the prependData and extendData but i´m not sure if this is what i have to use to make what i want

Thanks

---

<div class="post-metadata">

**Author:** ![jlfsjunior](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/jlfsjunior/32/16061_2.png) [@jlfsjunior](https://community.plotly.com/u/jlfsjunior)\
**Post date:** [May 9, 2022, 9:23pm UTC](https://community.plotly.com/t/update-not-extend-graph-data-but-not-layout/63914/2 "2022-05-09T21:23:55Z")

</div>

Hi,

Just to clarify, do you want to add new traces to the figure or do you want to add extra points/lines ?

---

<div class="post-metadata">

**Author:** ![matinoseda](https://avatars.discourse-cdn.com/v4/letter/m/f07891/32.png) [@matinoseda](https://community.plotly.com/u/matinoseda)\
**Post date:** [May 10, 2022, 12:23pm UTC](https://community.plotly.com/t/update-not-extend-graph-data-but-not-layout/63914/3 "2022-05-10T12:23:13Z")

</div>

Same traces, always, and i just want to update the data points, not the hole figure to optimize performance.

---

<div class="post-metadata">

**Author:** ![jlfsjunior](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/jlfsjunior/32/16061_2.png) [@jlfsjunior](https://community.plotly.com/u/jlfsjunior)\
**Post date:** [May 10, 2022, 8:25pm UTC](https://community.plotly.com/t/update-not-extend-graph-data-but-not-layout/63914/4 "2022-05-10T20:25:45Z")

</div>

Ok. You can use `extendData` in this case, even if you want to replace all current points with new ones, because there is no “updateData” equivalent. The way to do it is to pass `maxPoints` explicitly and select a value that matches the length of the added data. [Here](https://plotly.com/javascript/plotlyjs-function-reference/#plotlyextendtraces) you can find the original documentation in JS, where there is one example in which only 10 points of each trace are kept after each update.

Please let me know if you cant still figure this out. I have a few examples I can provide you regarding `extendData` and the syntax is a bit complicated/undocumented.
