GreenBankObservatory/dysh

Plot multiple spectra on one set of axes

Opened this issue · 1 comments

Feature description
I am troubleshooting a project that uses multiple IFs to cover a wider chunk of bandwidth. I would like to be able to plot each bandpass shape and each polarization on the same set of axes with dysh's SpectrumPlot class - dysh.plot.specplot.SpectrumPlot(spectrum, **kwargs)[[s](https://dysh.readthedocs.io/en/latest/_modules/dysh/plot/specplot.html#SpectrumPlot)

Solution
Not sure. My apologies if I'm missing some obvious, existing functionality.

Additional context
My current code. This produces a different figure for each function call.
image

Hi Jay, you didn't miss anything, there is currently no way of doing this with dysh functions. This feature will be available in a future release of dysh.

For now, you could plot things on your own using maptlotlib or your favorite plotting library. A possibility, based of your example:

import matplotlib.pyplot as plt
fig = plt.figure(dpi=150)
ax1 = fig.add_subplot(111)
# back to your example code here
for i in range(0, len(rem8if), 2):
    j = i + 1
    spec = rem8if[i].timeaverage()
    ax1.plot(spec.spectral_axis.to("GHz"), spec.flux.value, c="r", label="plnum 0")
    spec = rem8if[j].timeaverage()
    ax1.plot(spec.spectral_axis.to("GHz"), spec.flux.value, c="b", label="plnum 1")
ax1.legend(); # Display legend at the end.

I hope this helps.

We'll leave the issue open to remind ourselves to deliver the feature.