modelskill
modelskill copied to clipboard
First attempt at ComparerCollection.plot.timeseries
ComparerCollection lacks a simple way to plot all timeseries in one go.
This is some stumbling steps of utilizing plt.subplots, but it is far from perfect.
Once this is polished, it will also be relevant to be able to subset the collection in a terse way, e.g. with wildcards.
Python + R it makes it possible to get good plots with readable syntax.
import modelskill as ms
...
cc = ms.ComparerCollection(cmps)
ldf = cc._to_long_dataframe().reset_index()
sel_station <- py$ldf |>
select(observation) |>
distinct() |>
slice(1:3) |>
pull(observation)
py$ldf |>
filter(observation %in% sel_station) |>
ggplot(aes(time, obs_val)) +
geom_point(size=1, shape="+") +
geom_line(aes(time, mod_val, color=model)) +
facet_grid(vars(observation), scales="free_y") +
labs(x="Time", y="Discharge [m3/s]") +
theme_bw()
Could I do the same with plotnine in Python 🤔