Skip to content

Register named IFO colours with matplotlib

This PR modifies the gwpy.plotter.colors module to register the IFO colours (previously GW_OBSERVATORY_COLORS) with matplotlib so that they can be referenced as normal when plotting, e.g.:

from gwpy.timeseries import TimeSeries
from gwpy.plotter import TimeSeriesPlot
h1 = TimeSeries.fetch_open_data('H1', 1126259457, 1126259467)
h1b = h1.bandpass(50, 250).notch(60).notch(120)
l1 = TimeSeries.fetch_open_data('L1', 1126259457, 1126259467)
l1b = l1.bandpass(50, 250).notch(60).notch(120)
plot = TimeSeriesPlot(figsize=(8, 4))
ax = plot.gca()
ax.plot(h1b, color='gwpy:ligo-hanford', label='LIGO-Hanford')
ax.plot(l1b, color='gwpy:ligo-livingston', label='LIGO-Livingston')
ax.set_xscale('seconds', epoch=1126259462)
ax.set_xlim(1126259462, 1126259462.6)
ax.set_xlabel('Time (seconds) from Sep 14 2015 09:50:45 UTC')
ax.set_ylim(-1e-21, 1e-21)
ax.set_ylabel('Strain noise')
ax.legend()
plot.show()

image

I added a new documentation page demonstrating the use of the colours.

Merge request reports