DHI / mikeio

Read, write and manipulate dfs0, dfs1, dfs2, dfs3, dfsu and mesh files.
https://dhi.github.io/mikeio
BSD 3-Clause "New" or "Revised" License
139 stars 56 forks source link

Pass kwargs to plot.mesh #680

Open chrisawhitwell opened 7 months ago

chrisawhitwell commented 7 months ago

Hi,

I am relatively new to the package so feel free to close if this functionality exists (if so, maybe incorporating into the docs would be helpful).

We should be able to pass kwargs to the matplotlib function that is being used by mikeio when using the plot methods.

For example, if I want to change the colors/line widths etc of a mesh in a dfsu, it might look like.

fig, axes = plt.subplots()
mds.geometry.plot.mesh()
collection = axes.get_children()[0]
collection.set(**kwargs)

but this could be:

mds.geometry.plot.mesh(**kwargs)
ecomodeller commented 7 months ago

Hi @chrisawhitwell, would you like to submit a PR with your suggestion?

The place to start tweaking is https://github.com/DHI/mikeio/blob/d9055794f5f416750b7929e7d1e3cac56a6d5ec2/mikeio/spatial/_FM_geometry.py#L126

Please also add a test that showcases the functionality.

chrisawhitwell commented 7 months ago

Hey @ecomodeller, Sure thing I will get to it when I find some time!