Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Trying to swap yaxis on click of a series


I am trying to show the respective yaxis of the series clicked and hide the rest. I am able to achieve this by using Plotly.newplot but i am able to achieve the same with Plotly.update.

I have created a codepen and please try this by commenting the newplot line and uncommenting the update.

Please advice!

(note: the issue is, if i use newplot the click event is no more active.)

Looks like you’re trying to pass whole data and layout object to Plotly.update instead of data/layout patches like what is expected.

Something like

Plotly.update('myDiv', {/* leave this empty - you're not changing the anything in the traces */}, {
  'yaxis.showline': true,
  'yaxis.showticklabels': true,
  // ....
  'yaxis.title': 'new title' 
1 Like

Thank You! I got it working.