Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First attempt at ComparerCollection.plot.timeseries #411

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ecomodeller
Copy link
Member

@ecomodeller ecomodeller commented Jan 30, 2024

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.

image

@ecomodeller
Copy link
Member Author

ecomodeller commented Jan 30, 2024

Python + R it makes it possible to get good plots with readable syntax.

image

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 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant