Skip to content

puncturedfem.plot.GlobalFunctionPlot

Plot a global function.

Attributes:

Name Type Description
solver Solver

A Solver object, which contains the Mesh and the basis functions.

coef np.ndarray

The coefficients of the linear combination of basis functions.

fill bool

If True, a heatmap is plotted. If False, a contour plot is plotted.

title str

The title of the plot.

show_colorbar bool

If True, a colorbar is shown.

show_axis bool

If True, the axis is shown.

colormap Optional[Colormap]

The colormap used for the plot.

__init__(solver, coef=None)

Initialize a GlobalFunctionPlot object.

Parameters:

Name Type Description Default
solver Solver

A Solver object, which contains the Mesh and the basis functions.

required
coef np.ndarray

The coefficients of the linear combination of basis functions.

None

draw(plot_type='values', show_plot=True, filename='', **kwargs)

Draw the plot.

Parameters:

Name Type Description Default
show_plot bool, optional

If True, the plot is shown. Default is True.

True
filename str, optional

If not empty, the plot is saved to this file. Default is "".

''

Other Parameters:

Name Type Description
fill bool, optional

If True, a heatmap is plotted. If False, a contour plot is plotted. Default is True.

title str, optional

The title of the plot. Default is "", i.e. no title.

show_colorbar bool, optional

If True, a colorbar is shown. Default is True.

show_axis bool, optional

If True, the axis is shown. Default is True.

colormap Optional[Colormap], optional

The colormap used for the plot. Default is None.

set_coefficients(coef=None)

Set the coefficients of the linear combination of basis functions.

Parameters:

Name Type Description Default
coef np.ndarray, optional

The coefficients of the linear combination of basis functions. Default is None. If None, the solver object must have an attribute soln.

None

set_solver(solver)

Set the solver object.

Parameters:

Name Type Description Default
solver Solver

A Solver object, which contains the Mesh and the basis functions.

required