Is there a way to make an axis invisible if all traces using that axis are invisible?

Is there a way to make an axis invisible if all traces using that axis are invisible?

Our group produces experiment overview plots with a large number of traces plotted on a large number of y-axes. It seems that each new variable that we want to examine requires a new axis, and the number of different axes is ridiculous.

Here’s an example:

I’ve somewhat arbitrarily decided that the limit is ten, but it feels like each day we bump into this ceiling

One way to keep the plots from getting ludicrously confusing would be to make unused axes invisible. i.e. if there are no visible traces plotted against the axis, it would disappear, and only reappear when one of the traces plotted against it is made visible.

e.g. in plot above, the “pressure” axis is only used by one trace, which is not visible.

Just off the top of my head, I can think of lots of reasons why this wouldn’t work. For example, Plotly requires axis position to be set explicitly. So even if axes were made invisible, there would still be a gap where the axis used to be. But I find it hard to believe that this is not a common problem.

I’m sure the answer is basically “Use Dash”, and then add a callback to toggling trace visibility. And I’d be all on board with this, except that (as I understand it) Dash requires a server process, and interactive plots cannot just be encapsulated in a standalone HTML file as is possible with Plotly. I need plots that can be easily exchanged via email etc.

Any thoughts on this? It seems like it would require a lot of work: for example, solving the multiple axis positioning headache would require that there be a way to say to Plotly, “I don’t care exactly where the y-axes are positioned, just place them according to some standard recipe. e.g. alternating left and right sides, adding them from the inside outward”. Or all on left side etc. That part, at least, seems like it would be pretty handy in its own right. Dealing with multiple axes in Plotly always seems more painful than it should be.