# Set plot trace visibility toggle when creating plot

**URL:** <https://community.plotly.com/t/set-plot-trace-visibility-toggle-when-creating-plot/13322>\
**Category:** plotly.js\
**Created:** [September 5, 2018, 5:46pm UTC](https://community.plotly.com/t/set-plot-trace-visibility-toggle-when-creating-plot/13322 "2018-09-05T17:46:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![NathanRice](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/nathanrice/32/4083_2.png) [@NathanRice](https://community.plotly.com/u/NathanRice)\
**Post date:** [September 5, 2018, 5:46pm UTC](https://community.plotly.com/t/set-plot-trace-visibility-toggle-when-creating-plot/13322/1 "2018-09-05T17:46:30Z")

</div>

I’m using react-ploty.js, and I’ve got a plot that is periodically updated with new data. Whenever the component is updated the re-render clears the current legend trace visibility toggles. Is there a way to specify the trace visibility via layout/config?

---

<div class="post-metadata">

**Author:** ![etienne](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/etienne/32/17_2.png) [@etienne](https://community.plotly.com/u/etienne)\
**Post date:** [September 6, 2018, 5:47pm UTC](https://community.plotly.com/t/set-plot-trace-visibility-toggle-when-creating-plot/13322/2 "2018-09-06T17:47:15Z")

</div>

See [https://github.com/plotly/plotly.js/issues/2608](https://github.com/plotly/plotly.js/issues/2608) for more on this topic.
