pymor.discretizers.builtin.gui.visualizers

Module Contents

class pymor.discretizers.builtin.gui.visualizers.OnedVisualizer(grid, codim=1, block=False, backend='jupyter_or_matplotlib')[source]

Bases: pymor.core.base.ImmutableObject

Visualize scalar data associated to a one-dimensional Grid as a plot.

The grid’s ReferenceElement must be the line. The data can either be attached to the subintervals or vertices of the grid.

Parameters

grid

The underlying Grid.

codim

The codimension of the entities the data in U is attached to (either 0 or 1).

block

If True, block execution until the plot window is closed.

backend

Plot backend to use (‘jupyter_or_matplotlib’, ‘jupyter’, ‘matplotlib’).

Methods

visualize

Visualize the provided data.

visualize(U, title=None, legend=None, separate_plots=True, separate_axes=False, block=None, filename=None, columns=2)[source]

Visualize the provided data.

Parameters

U

VectorArray of the data to visualize. If len(U) > 1, the data is visualized as a time series of plots. Alternatively, a tuple of VectorArrays can be provided, in which case several plots are made into the same axes. The lengths of all arrays have to agree.

title

Title of the plot.

legend

Description of the data that is plotted. Most useful if U is a tuple in which case legend has to be a tuple of strings of the same length.

block

If True, block execution until the plot window is closed. If None, use the default provided during instantiation.

class pymor.discretizers.builtin.gui.visualizers.PatchVisualizer(grid, codim=2, bounding_box=None, backend='jupyter_or_gl', block=False)[source]

Bases: pymor.core.base.ImmutableObject

Visualize scalar data associated to a two-dimensional Grid as a patch plot.

The grid’s ReferenceElement must be the triangle or square. The data can either be attached to the faces or vertices of the grid.

Parameters

grid

The underlying Grid.

codim

The codimension of the entities the data in U is attached to (either 0 or 2).

bounding_box

A bounding box in which the grid is contained.

backend

Plot backend to use (‘jupyter_or_gl’, ‘jupyter’, ‘gl’, ‘matplotlib’).

block

If True, block execution until the plot window is closed.

Methods

visualize

Visualize the provided data.

visualize(U, title=None, legend=None, separate_colorbars=False, rescale_colorbars=False, block=None, filename=None, columns=2)[source]

Visualize the provided data.

Parameters

U

VectorArray of the data to visualize. If len(U) > 1, the data is visualized as a time series of plots. Alternatively, a tuple of VectorArrays can be provided, in which case a subplot is created for each entry of the tuple. The lengths of all arrays have to agree.

title

Title of the plot.

legend

Description of the data that is plotted. Most useful if U is a tuple in which case legend has to be a tuple of strings of the same length.

separate_colorbars

If True, use separate colorbars for each subplot.

rescale_colorbars

If True, rescale colorbars to data in each frame.

block

If True, block execution until the plot window is closed. If None, use the default provided during instantiation.

filename

If specified, write the data to a VTK-file using write_vtk instead of displaying it.

columns

The number of columns in the visualizer GUI in case multiple plots are displayed at the same time.