Use theme instead of several optional parameters for general_plotter
See original GitHub issueEdit: Progress
- basic pyvista Theme functionallity (PR #477)
- discuss/add additional values for MapdlTheme class (numbering, etc.)
- consider
plot_nodal...
->plot(solution: NodalSolution)
It might be useful, to make second and third part into new issues.
EndEdit
Sorry for spamming issues, but as I play with the plot functionality (including pyvista, which is also new for me), I get a lot of ideas ^^
There are many parameters to change the look of plots, and also some missing parameters (e.g. to change label format). Even worse, by setting some of these to default values, its not possible to use pyvista themes like ‘document’ or ‘night’ without “removing” those default values (by setting parameters to ''
). Lables can’t be changed at all.
def plot_geometry(mapdl: MapdlCorba, theme="document"):
pv.set_plot_theme(theme)
plotter = pv.Plotter(shape=(2, 2))
mapdl.nplot(plotter=plotter, color='')
plotter.subplot(0, 1)
mapdl.lplot(plotter=plotter, color='')#color_lines=True) # color="#000000")
plotter.subplot(1, 0)
mapdl.aplot(plotter=plotter, color='')
plotter.subplot(1, 1)
mapdl.eplot(plotter=plotter, color='')
plotter.link_views()
plotter.show(screenshot=True)
plotter.screenshot(f'multiplot_example')
I think it would be better to use a Theme to format most of the plot. It would be much cleaner and easier to use. Up till now I didn’t find, how to use/add a custom theme with pyvista. But it seems like a simple dict to me - so it should be easy to add for pyvista, if it is really not implemented yet.
Issue Analytics
- State:
- Created 2 years ago
- Comments:15 (14 by maintainers)
I think this feature warrants a quick release as it’s a critical feature for modules that rely on pyvista. I’ll try to push one out soon, potentially over the weekend.
This probably goes in line with making plotting an external library where the plotting is made by a class.
Or maybe we just need to call pyvista…