plot_ants_plane

plot_ants_plane(notebook=None)

Plot two ants and airplane.

Demonstrate how to create a plot class to plot multiple meshes while adding scalars and text.

This example plots the following:

>>> import pyvista
>>> from pyvista import examples

Load and shrink airplane

>>> airplane = examples.load_airplane()
>>> airplane.points /= 10

Rotate and translate ant so it is on the plane.

>>> ant = examples.load_ant()
>>> ant.rotate_x(90)
>>> ant.translate([90, 60, 15])

Make a copy and add another ant.

>>> ant_copy = ant.copy()
>>> ant_copy.translate([30, 0, -10])

Create plotting object.

>>> plotter = pyvista.Plotter()
>>> _ = plotter.add_mesh(ant, 'r')
>>> _ = plotter.add_mesh(ant_copy, 'b')

Add airplane mesh and make the color equal to the Y position.

>>> plane_scalars = airplane.points[:, 1]
>>> _ = plotter.add_mesh(airplane, scalars=plane_scalars,
...                      scalar_bar_args={'title': 'Plane Y Location'})
>>> _ = plotter.add_text('Ants and Plane Example')
>>> plotter.show()
Parameters
notebookbool, optional

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

Examples

>>> from pyvista import demos
>>> demos.plot_ants_plane()
../../../_images/pyvista-demos-demos-plot_ants_plane-1_00_00.png