Plot without ax manipulation for plot composition #556
Hendrik1987
started this conversation in
Ideas
Replies: 2 comments 3 replies
-
Just to be clear on what you want to achieve in this specific case. You only care about the extent of the model domains? |
Beta Was this translation helpful? Give feedback.
0 replies
-
I would do it like this: import mikeio
import matplotlib.pyplot as plt
msh = mikeio.Mesh("../tests/testdata/odense_rough.mesh")
exterior = msh.geometry.to_shapely().buffer(0) # this is the model domain
subdomain = exterior.centroid.buffer(1000) # this is just to illustrate a possible subdomain
plt.plot(*exterior.exterior.xy, label="Model domain")
plt.plot(*subdomain.exterior.xy, color="red", label="Subdomain")
plt.legend(); |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Background
Most plot functionalities in
mikeio
make default settings for figsize, axis limits and axis ratio. This is super handy for most use cases in order to quickly get the most relevant plot appearance.However, sometimes if find that I want to compile multiple mikeio plots in the same
ax
. I can pass theax
argument, but still, the latest call of a plot function will define the axis ratio etc..Example
I want to plot the outline of an inner domain into the parent domain. The directly available solution does not give the desired result as it that will zoom into the inner domain. Also the title will be governed by the
outline
plot.My workaround
Currently I achieve what I want like this:
Monkey patching to a private class is of course not very tidy...
Desired functionality / idea
I think it could be nice to have the option to only add objects to an axis without manipulating the axis.
Assuming that when
ax
is passed, it is not manipulated might be too simple, so maybe just aplot_only
argument would do?Looking forward to other thoughts and ideas :-)
Beta Was this translation helpful? Give feedback.
All reactions