# JS Control of Plot Generated by Python

**URL:** <https://community.plotly.com/t/js-control-of-plot-generated-by-python/84948>\
**Category:** 📊 Plotly Python\
**Created:** [June 4, 2024, 5:03pm UTC](https://community.plotly.com/t/js-control-of-plot-generated-by-python/84948 "2024-06-04T17:03:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sine1son](https://avatars.discourse-cdn.com/v4/letter/s/258eb7/32.png) [@sine1son](https://community.plotly.com/u/sine1son)\
**Post date:** [June 4, 2024, 5:03pm UTC](https://community.plotly.com/t/js-control-of-plot-generated-by-python/84948/1 "2024-06-04T17:03:07Z")

</div>

I would like to make a plot that has 15 different heatmap traces (static data so I can export to file I think) and then show/hide them via external javascript, or built-in plotly functionality. I don’t think that visible=‘legendonly’ will work because then I’ll have 15 legends on screen

Thank you in advance!

---

<div class="post-metadata">

**Author:** ![AIMPED](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/aimped/32/21758_2.png) [@AIMPED](https://community.plotly.com/u/AIMPED)\
**Post date:** [June 4, 2024, 7:24pm UTC](https://community.plotly.com/t/js-control-of-plot-generated-by-python/84948/2 "2024-06-04T19:24:38Z")

</div>

Hey @sine1son welcome to the forum. You could select the underlying data via a dropdown. There are some topics on the form on how to do that- is this is an option for you.

---

<div class="post-metadata">

**Author:** ![sine1son](https://avatars.discourse-cdn.com/v4/letter/s/258eb7/32.png) [@sine1son](https://community.plotly.com/u/sine1son)\
**Post date:** [June 5, 2024, 8:16pm UTC](https://community.plotly.com/t/js-control-of-plot-generated-by-python/84948/3 "2024-06-05T20:16:23Z")

</div>

I’m not sure I can switch underlying data because the heatmap matrix is generated on the backend, but if I could just show/hide traces or layers via a dropdown that would be great, can you link to an example?

Thank you!

---

<div class="post-metadata">

**Author:** ![AIMPED](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/aimped/32/21758_2.png) [@AIMPED](https://community.plotly.com/u/AIMPED)\
**Post date:** [June 6, 2024, 2:00pm UTC](https://community.plotly.com/t/js-control-of-plot-generated-by-python/84948/4 "2024-06-06T14:00:45Z")

</div>

Maybe this helps you?

> [@Change a specific trace data with button](https://community.plotly.com/t/change-a-specific-trace-data-with-button/71050):
>
> Hi there, Let me know how I can change a specific trace using buttons? look at the following code: import plotly.graph\_objs as go import random as rnd num\_steps = 3 fig=go.Figure() fig.add\_scatter(y=[0, 0, 0], line={'color': 'red'},name='firsttrace') fig.add\_scatter(y=[3, 3, 3], line={'color': 'blue'},name='Secondttrace') fig.add\_scatter(y=[2, 2, 2], line={'color': 'purple'},name='Thirdtrace') fig.add\_scatter(y=[1, 1, 1], line={'color': 'gray'},name='Forthtrace') buttons = [] for i in r…
