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=False, rescale_axes=False, block=None, columns=2, return_widget=False)[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.

separate_plots

If True, use multiple figures to visualize multiple VectorArrays.

rescale_axes

If True, rescale axes to data in each frame.

block

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

columns

Number of columns the subplots are organized in.

return_widget

If True, create an interactive visualization that can be used as a jupyter widget.

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, return_widget=False, **kwargs)[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.

columns

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

filename

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

return_widget

If True, create an interactive visualization that can be used as a jupyter widget.

kwargs

Additional backend-specific arguments.