ansys.mapdl.core.plotting.general_plotter(meshes, points, labels, title='', cpos=None, show_bounds=False, show_axes=True, background=None, off_screen=None, savefig=None, window_size=None, notebook=None, style=None, color='w', show_edges=None, edge_color=None, point_size=5.0, line_width=None, opacity=1.0, flip_scalars=False, lighting=None, n_colors=256, interpolate_before_map=True, cmap=None, render_points_as_spheres=False, render_lines_as_tubes=False, scalar_bar_args={}, smooth_shading=None, split_sharp_edges=None, feature_angle=30.0, show_scalar_bar=None, font_size=None, font_family=None, text_color=None, theme=None, return_plotter=False, return_cpos=False)

General pymapdl plotter for APDL geometry and meshes.

titlestr, optional

Add given title to plot.

cposlist(tuple(floats)), str

The camera position to use. You can either use a saved camera position or specify one of the following strings:

  • "xy"

  • "xz"

  • "yz"

  • "yx"

  • "zx"

  • "zy"

  • "iso"

off_screenbool, optional

Renders off screen when True. Useful for automated screenshots.

window_sizelist, optional

Window size in pixels. Defaults to [1024, 768]

notebookbool, optional

When True, the resulting plot is placed inline a jupyter notebook. Assumes a jupyter console is active. Automatically enables off_screen.

show_boundsbool, optional

Shows mesh bounds when True.

show_axesbool, optional

Shows a vtk axes widget. Enabled by default.

savefigstr, optional

Saves screenshot to a file path. If used, notebook and off_screen are evaluated to False and True respectively.

stylestr, optional

Visualization style of the mesh. One of the following: style='surface', style='wireframe', style='points'. Defaults to 'surface'. Note that 'wireframe' only shows a wireframe of the outer geometry.

colorstr or 3 item list, optional

Use to make the entire mesh have a single solid color. Either a string, RGB list, or hex color string. For example: color='white', color='w', color=[1, 1, 1], or color='#FFFFFF'. Color will be overridden if scalars are specified.

show_edgesbool, optional

Shows the edges of a mesh. Does not apply to a wireframe representation.

edge_colorstr or 3 item list, optional, defaults to black

The solid color to give the edges when show_edges=True. Either a string, RGB list, or hex color string.

point_sizefloat, optional

Point size of any nodes in the dataset plotted. Also applicable when style='points'. Default 5.0

line_widthfloat, optional

Thickness of lines. Only valid for wireframe and surface representations. Default None.

opacityfloat, str, array_like

Opacity of the mesh. If a single float value is given, it will be the global opacity of the mesh and uniformly applied everywhere should be between 0 and 1. A string can also be specified to map the scalars range to a predefined opacity transfer function (options include: 'linear', 'linear_r', 'geom', or 'geom_r'). A string could also be used to map a scalars array from the mesh to the opacity (must have same number of elements as the scalars argument). Or you can pass a custom made transfer function that is an array either n_colors in length or shorter.

n_colorsint, optional

Number of colors to use when displaying scalars. Defaults to 256. The scalar bar will also have this many colors.

cmapstr, list, optional

Name of the Matplotlib colormap to us when mapping the scalars. See available Matplotlib colormaps. Only applicable for when displaying scalars. Requires Matplotlib to be installed. colormap is also an accepted alias for this. If colorcet or cmocean are installed, their colormaps can be specified by name.

You can also specify a list of colors to override an existing colormap with a custom one. For example, to create a three color colormap you might specify ['green', 'red', 'blue']

render_points_as_spheresbool, optional

Render points as spheres.

render_lines_as_tubesbool, optional

Renders lines as tubes.

smooth_shadingbool, optional

Smoothly render curved surfaces when plotting. Not helpful for all meshes.

split_sharp_edgebool, optional

Split sharp edges exceeding 30 degrees when plotting with smooth shading. Control the angle with the optional keyword argument feature_angle. By default this is False.


Note that enabling this will create a copy of the input mesh within the plotter.

feature_anglefloat, optional

Angle to consider an edge a sharp edge. Default 30 degrees.

themepyvista.DefaultTheme, optional

PyVista theme. Defaults to PyMAPDL theme.

return_plotterbool, optional

Return the plotting object rather than showing the plot and returning the camera position. Default False.

return_cposbool, optional

Returns the camera position as an array. Default False.

cpos or pyvista.Plotter

Camera position or instance of pyvista.Plotter depending on return_plotter.


Plot areas and modify the background color to 'black'

>>> cpos = mapdl.aplot(background='black')

Enable smooth_shading on an element plot.

>>> cpos = mapdl.eplot(smooth_shading=True)

Return the plotting instance, modify it, and display the plot.

>>> pl = mapdl.aplot(return_plotter=True)
>>> pl.show_bounds()
>>> pl.set_background('black')
>>> pl.add_text('my text')

Save a screenshot to disk without showing the plot.

>>> mapdl.eplot(background='w', show_edges=True, smooth_shading=True,
                window_size=[1920, 1080], savefig='screenshot.png',