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

Better plots for TTim #70

Closed
dbrakenhoff opened this issue Oct 2, 2024 · 6 comments · Fixed by #76
Closed

Better plots for TTim #70

dbrakenhoff opened this issue Oct 2, 2024 · 6 comments · Fixed by #76

Comments

@dbrakenhoff
Copy link
Collaborator

dbrakenhoff commented Oct 2, 2024

The plot functions under the model object in TTim are somewhat limited.

Proposal:

  • move to a plotting submodule (like pastas). ml.plots.topview() ml.plots.xsection() instead of having all plot functions directly in the model class.
  • keep ml.plot(): plot top-view of model with optional layer arg
  • modify ml.xsection() to plot cross-section of model
  • the current ml.xsection() becomes something like ml.plot.heads_along_line()

Other suggestions welcome!

@dbrakenhoff
Copy link
Collaborator Author

Example for a cross-section:

ml.plots.xsection(labels=True, params=True)

image

@HMEUW
Copy link

HMEUW commented Oct 2, 2024

Great idea. Some additional ideas:

  • plotting returns a fig and ax handle, so you can adjust your plot
  • deals also with TimML models
  • plot location and property of elements as well (e.g. LineSinks)
  • I would like to use plotly for interactive online plots (sneak peak at https://gwdijk.anvil.app/), some way to facilitate that should be great. Seperate plotly part, or plot function that returns x and y lists of data to plot
  • highlight aquifer that is plotted, when plotting in a section,

@dbrakenhoff
Copy link
Collaborator Author

Good suggestions.

  • returning ax is definitely something we want (figure is always available through ax.figure)
  • plot location and property of elements as well (e.g. LineSinks)

This is a bit of a challenge, though definitely doable. We'd need to compute intersections for all elements the line crosses. And give each element a e.plot_xsection() method that takes some distance r as input and plots the vertical representation of the element at that location. Giving each element a shapely representation through e.geometry would make that fairly easy though (as suggested here: mbakker7/timml#69).

Seperate plotly part, or plot function that returns x and y lists of data to plot

What would you need for these plots? For now you could add a tim_plotly repository to the tim groundwater organization. With methods that take a Tim-model as input and produce some kind of plotly plot.

  • highlight aquifer that is plotted, when plotting in a section,

What do you mean by this one?

@mbakker7
Copy link
Owner

mbakker7 commented Oct 3, 2024

Nice ideas. I suggest to start with a plots module and add some functionality there.

@HMEUW
Copy link

HMEUW commented Oct 3, 2024

highlight aquifer that is plotted, when plotting in a section: What do you mean by this one?

See example below. Lines are calculated heads in aquifer 1 and 2. The aquifers are filled to indicate in which aquifer the calculated heads are present. Or dashed line in the center of the aquifer.

image

image

@dbrakenhoff dbrakenhoff linked a pull request Nov 7, 2024 that will close this issue
@dbrakenhoff
Copy link
Collaborator Author

This was implemented in #76. Closing this issue.

The aquifer cross-section and heads plot can be easily done with:

xy = [(x0, y0), (x1, y1)]
ax = ml.plots.xsection(xy)
ml.plots.headalongline(x0, x1, y0, y1, ax=ax)
ax.legend(loc=(0, 1), frameon=False, ncol=4)

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 a pull request may close this issue.

3 participants