pastas / pastastore

:spaghetti: :convenience_store: Tools for managing timeseries and Pastas models
https://pastastore.readthedocs.io
MIT License
15 stars 4 forks source link

Plot both oseries and stresses by default in data_availability plot #90

Closed martinvonk closed 1 year ago

martinvonk commented 1 year ago

Currently the data_availability plots needs a library name (libname argument): "oseries" v "stresses" https://github.com/pastas/pastastore/blob/28ea9f2b7eea502cfb9006cb839b0ad01eef4bc7/pastastore/plotting.py#L210-L226

I'd like to make the default None which plots both libraries in a plot like the one below. Here the oseries are plotted in the upper Axes, and stresses in the lower Axes and the colorbar is shared. 01_Data_Availability

Thoughts @dbrakenhoff ?

martinvonk commented 1 year ago
fig, ax = plt.subplot_mosaic(
    [["oseries", "cax"], ["stresses", "cax"]],
    figsize=(12, (len(pstore.oseries) + len(pstore.stresses)) / 6),
    height_ratios=[len(pstore.oseries), len(pstore.stresses)],
    width_ratios=[10, 1],
)
pstore.plots.data_availability(
    "oseries",
    intervals=intervals,
    set_yticks=True,
    ax=ax["oseries"],
    cax=ax["cax"],
)
ax["oseries"].set_title("Grondwaterstanden", fontsize=10)

pstore.plots.data_availability(
    "stresses",
    intervals=intervals,
    set_yticks=True,
    ax=ax["stresses"],
    cax=ax["cax"],
)

ax["stresses"].set_xlim(
    left=pstore.get_tmin_tmax("oseries").tmin.min(),
    right=pstore.get_tmin_tmax("oseries").tmax.max(),
)

ax["stresses"].set_title("Oppervlaktewaterstanden en Meteorologie", fontsize=10)
fig.tight_layout()
fig.suptitle("Data Beschikbaarheid", y=1.01)
dbrakenhoff commented 1 year ago

I'd add a method data_availability_all() and implement this option there.

martinvonk commented 1 year ago

Let's just leave it at is. I can just copy the code stated here, no need for an extra plot method.