Tengo una trama que se parece a:

El eje x se comparte y los ejes y no. Actualmente tengo un código que al hacer doble clic en un rastro en la leyenda eliminará los otros dos rastros y mostrará solo un rastro. Aquí está el código relevante:
var myPlot = document.getElementById('graph'); myPlot.on('plotly_legenddoubleclick', function(data){ var trace = data.curveNumber + 1; if (trace == 1 && flag2 == 0) { var layout_update = {title: "Historical Trend", autosize: true, xaxis: {title:"Date", type: "date", rangeselector: {buttons: [{count: 1,label: '1m',step: 'month',stepmode: 'backward'},{count: 3,label: '3m',step: 'month',stepmode: 'backward'},{count: 6,label: '6m',step: 'month',stepmode: 'backward'},{step: 'all'}]}},yaxis: {title:"Vertical",fixedrange: true}}; Plotly.update('graph', layout_update); Plotly.deleteTraces('graph', 1); Plotly.deleteTraces('graph', 1); flag2 = 1; } else if (trace == 2 && flag2 == 0) { var layout_update = {title: "Historical Trend", autosize: true, xaxis: {title:"Date", type: "date", rangeselector: {buttons: [{count: 1,label: '1m',step: 'month',stepmode: 'backward'},{count: 3,label: '3m',step: 'month',stepmode: 'backward'},{count: 6,label: '6m',step: 'month',stepmode: 'backward'},{step: 'all'}]}},yaxis: {title:"Horizontal",fixedrange: true}}; Plotly.update('graph', layout_update); Plotly.deleteTraces('graph', 0); Plotly.deleteTraces('graph', 1); flag2 = 1; } else if (trace == 3 && flag2 == 0) { var layout_update = {title: "Historical Trend", autosize: true, xaxis: {title:"Date", type: "date", rangeselector: {buttons: [{count: 1,label: '1m',step: 'month',stepmode: 'backward'},{count: 3,label: '3m',step: 'month',stepmode: 'backward'},{count: 6,label: '6m',step: 'month',stepmode: 'backward'},{step: 'all'}]}},yaxis: {title:"Axial",fixedrange: true}}; Plotly.update('graph', layout_update); Plotly.deleteTraces('graph', 0); Plotly.deleteTraces('graph', 0); flag2 = 1; } }); Quiero incluir una cláusula con flag == 1 que devolverá la vista a la vista de trama 3. ¿Cómo puedo hacer esto?