graspfile.plot

Functions

get_axes(n_axes[, ax_label, ay_label]) Generate a set of axes ready for plotting multiple fields or grids.
get_max_fields(fields, step[, component, db]) Finds the maximum amplitude in the set of fields and return a suitable common limit for plotting all fields.
plot_amplitude_fields(fields, component[, …]) Plot all of the fields supplied as subplots in a single figure.
plot_amplitude_grids(grids, field, component) Plot all of the fields supplied as subplots in a single figure.
plot_phase_fields(fields, component[, …]) Plot the phase of all of the fields supplied as subplots in a single figure.
plot_phase_grids(grids, field, component[, …]) Plot the phase of all of the grids supplied as subplots in a single figure.
graspfile.plot.get_axes(n_axes, ax_label=None, ay_label=None)[source]

Generate a set of axes ready for plotting multiple fields or grids.

Parameters:
  • n_axes int – number of axes to generate.
  • ax_label str – label for x axes. Only shown on bottom axes.
  • ay_label str – label for y axes. Only shown on left-most axes.
Returns:

matplotlib.Figure – figure object. list: of matplotlib.Axes: list of individual subplot axes.

graspfile.plot.get_max_fields(fields, step, component=0, db=True)[source]

Finds the maximum amplitude in the set of fields and return a suitable common limit for plotting all fields.

Returns the next value equal to n x step above the maximum amplitude found.

Parameters:
  • fields (list – of GraspField): the set of fields to determine common limits for.
  • step (float) – Step size to change the limit by.
  • component (int) – index of the field component to use.
  • db (bool) – Work in db(amplitude)
Returns:

float – limit suitable for plotting all fields.

graspfile.plot.plot_amplitude_fields(fields, component, suptitle=None, titles=None, xlabel=None, ylabel=None, vlabel=None, limits=None, db=True, cmap='gist_heat')[source]

Plot all of the fields supplied as subplots in a single figure.

Parameters:
  • fields (list – of GraspField): set of fields to plot.
  • component (int – ): field component to plot.
  • suptitle (str – ): title to use for overall figure.
  • titles (list – of str:): titles to use for each field.
  • xlabel (str – ): x axis label.
  • ylabel (str – ): y axis label.
  • vlabel (str – ): colorbar label.
  • limits (tuple – of float:): lower and upper limits for color scale. If not given, will default to 0 to max for absolute, ~40 db below maximum for db.
  • db (bool – ): plot db (or absolute):
  • cmap (str – ): name of matplotlib cmap to use
Returns:

obj: matplotlib.Figure: matplotlib Figure containing the plots.

graspfile.plot.plot_amplitude_grids(grids, field, component, suptitle=None, titles=None, xlabel=None, ylabel=None, vlabel=None, limits=None, db=True, cmap='gist_heat')[source]

Plot all of the fields supplied as subplots in a single figure.

Parameters:
  • grids (list – of GraspField): set of grids to plot.
  • field (int – ): index of field from each grid to plot.
  • component (int – ): field component to plot.
  • suptitle (str – ): title to use for overall figure.
  • titles (list – of str:): titles to use for each field.
  • xlabel (str – ): x axis label.
  • ylabel (str – ): y axis label.
  • vlabel (str – ): colorbar label.
  • limits (tuple – of float:): lower and upper limits for color scale.
  • db (bool – ): plot db (or absolute):
  • cmap (str – ): name of matplotlib cmap to use
Returns:

obj: matplotlib.Figure: matplotlib Figure containing the plots.

graspfile.plot.plot_phase_fields(fields, component, suptitle=None, titles=None, xlabel=None, ylabel=None, vlabel=None, limits=None, cmap='jet')[source]

Plot the phase of all of the fields supplied as subplots in a single figure.

Parameters:
  • fields (list – of GraspField): set of fields to plot.
  • component (int – ): field component to plot.
  • suptitle (str – ): title to use for overall figure.
  • titles (list – of str:): titles to use for each field.
  • xlabel (str – ): x axis label.
  • ylabel (str – ): y axis label.
  • vlabel (str – ): colorbar label.
  • limits (tuple – of float:): lower and upper limits for color scale. If not given, plots will be from -180 to 180
  • db (bool – ): plot db (or absolute):
  • cmap (str – ): name of matplotlib cmap to use
Returns:

obj: matplotlib.Figure: matplotlib Figure containing the plots.

graspfile.plot.plot_phase_grids(grids, field, component, suptitle=None, titles=None, xlabel=None, ylabel=None, vlabel=None, limits=None, cmap='jet')[source]

Plot the phase of all of the grids supplied as subplots in a single figure.

Parameters:
  • grids (list – of GraspField): set of fields to plot.
  • field (int – ): index of field from each grid to plot.
  • component (int – ): field component to plot.
  • suptitle (str – ): title to use for overall figure.
  • titles (list – of str:): titles to use for each field.
  • xlabel (str – ): x axis label.
  • ylabel (str – ): y axis label.
  • vlabel (str – ): colorbar label.
  • limits (tuple – of float:): lower and upper limits for color scale. If not given, plots will be from -180 to 180
  • db (bool – ): plot db (or absolute):
  • cmap (str – ): name of matplotlib cmap to use
Returns:

obj: matplotlib.Figure: matplotlib Figure containing the plots.