spedas / pyspedas

Python-based Space Physics Environment Data Analysis Software
https://pyspedas.readthedocs.io/
MIT License
143 stars 58 forks source link

right_axis option isn't working #804

Closed jameswilburlewis closed 3 months ago

jameswilburlewis commented 3 months ago

A few revisions ago, setting the right_axis option to True on a pseudovariable created a plot with the spectrogram y scale on the left, and line plot scale on the right. This no longer works, probably due to the changes in pseudovariable handling.

I don't think right_axis ever worked for non pseudovariables. The logic is a bit convoluted. Hopefully it can be made to work more sensibly without too much extra effort.

jameswilburlewis commented 3 months ago

It works now for the case with one spectral variable + one line variable, with right_axis set on the pseudovariable.

The logic to this feature should probably be reimplemented, or even better, redesigned to be more useful in the general case. Someone might want more than a "left" and "right" Y-axis -- matplotlib will give you as many as you ask for with twinx(). It might make more sense as a per-spectrogram or per-trace attribute rather than per-panel.

Closing this issue because the immediate problem is fixed, but see https://github.com/spedas/pyspedas/issues/806