DiscretizedSpaceElement.show

DiscretizedSpaceElement.show(title=None, method='', coords=None, indices=None, force_show=False, fig=None, **kwargs)[source]

Display the function graphically.

Parameters:
titlestring, optional

Set the title of the figure

methodstring, optional

1d methods:

  • 'plot' : graph plot (default for 1d data)

  • 'scatter' : scattered 2d points (2nd axis <-> value)

2d methods:

  • 'imshow' : image plot with coloring according to value, including a colorbar (default for 2d data).

  • 'scatter' : cloud of scattered 3d points (3rd axis <-> value)

coordsarray-like, optional

Display a slice of the array instead of the full array. The values are shown accordinging to the given values, where None means all values along that dimension. For example, [None, None, 0.5] shows all values in the first two dimensions, with the third coordinate equal to 0.5. If a sequence is provided, it specifies the minimum and maximum point to be shown, i.e. [None, [0, 1]] shows all of the first axis and values between 0 and 1 in the second. This option is mutually exclusive with indices.

indicesint, slice, Ellipsis or sequence, optional

Display a slice of the array instead of the full array. If a sequence is given, the i-th entry indexes the i-th axis, with the following behavior for the different types of entries:

  • int: take entries with this index along axis i, removing this axis from the result

  • slice: take a subset along axis i, keeping it intact

  • None: equivalent to slice(None)

  • Ellipsis (...): equivalent to the number of None entries required to fill up the sequence to correct length.

The typical use case is to show a slice for a fixed index in a specific axis, which can be done most easily by setting, e.g., indices=[None, 50, None] to take the 2d slice parallel to the x-z coordinate plane at index y = 50.

A single int or slice object indexes the first axis, i.e., is treated as (int_or_slice, Ellipsis). For the default None, the array is kepty as-is for data that has at most 2 dimensions. For higher-dimensional data, the 2d slice in the first two axes at the middle position along the remaining axes is shown (semantically [:, :, shape[2:] // 2]). This option is mutually exclusive with coords.

force_showbool, optional

Whether the plot should be forced to be shown now or deferred until later. Note that some backends always displays the plot, regardless of this value.

figmatplotlib.figure.Figure, optional

The figure to show in. Expected to be of same "style", as the figure given by this function. The most common use case is that fig is the return value of an earlier call to this function.

Returns:
figmatplotlib.figure.Figure

The resulting figure. It is also shown to the user.

Other Parameters:
interp{'linear', 'nearest'}, optional

Interpolation type that should be used for the plot.

kwargs{'figsize', 'saveto', 'clim', ...}, optional

Extra keyword arguments passed on to the display method. See the Matplotlib functions for documentation of extra options.

See also

odl.util.graphics.show_discrete_data

Underlying implementation