question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use theme instead of several optional parameters for general_plotter

See original GitHub issue

Edit: 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')

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:open
  • Created 2 years ago
  • Comments:15 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
akaszynskicommented, May 14, 2021

@akaszynski I guess it will take a while until the new Theme-class becomes availeable in a new pyvista release, and afterwards in a new release of pymapdl. If you don’t plan to implement it right away in pymapdl (I can’t match your speed ^^), I would start to gather the different places where pymapdl is setting plot-format in a plotting_themes.py using the new pyvista themes over the weekend. Might help when deciding how to restructure pymapdl to use themes.

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.

0reactions
germa89commented, Jul 7, 2022

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…

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to pass optional parameters while omitting some other ...
The question is, as I see it, how one can bypass/skip several optional parameters and set only specific ones. – MaxB. Mar 28,...
Read more >
Optional Parameters - Visual Basic | Microsoft Learn
Optional parameters are indicated by the Optional keyword in the procedure definition. The following rules apply: Every optional parameter ...
Read more >
Dealing with Optional Parameters in Go | by Peter Malina
The simplest solution for dealing with a small number of variables is to use different functions. This technique uses WithX as a convention...
Read more >
How to create an optional input parameter with special name?
Commented: Aaron Mailhot on 3 Sep 2020. I would like to use an optional input parameter. As far as I know, the standard...
Read more >
Using Python Optional Arguments When Defining Functions
The primary purpose of a function is to allow you to reuse the code within it whenever you need it, using different inputs...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found