at.plot.generic#

AT generic plotting function

Functions

baseplot(ring, plot_function, *args, **kwargs)

Generic lattice plot

baseplot(ring, plot_function, *args, **kwargs)[source]#

Generic lattice plot

baseplot() divides the region of interest of ring into small elements, calls the specified function to get the plot data and calls matplotlib functions to generate the plot. By default, it creates a new figure for the plot, but if provided with Axes objects it can be used as part of a GUI

Parameters:
  • ring (Lattice) – Lattice description.

  • plot_function (Callable) –

    Specific data generating function to be called plotting function. plot_function is called as:

    title, left, right = plot_function(ring, refpts, *args, **kwargs)

    and should return 2 or 3 output:

    title: plot title or None

    left: tuple returning the data for the main (left) axis

    left[0] - y-axis label

    left[1] - xdata: (N,) array (s coordinate)

    left[2] - ydata: iterable of (N,) or (N,M) arrays. Lines from a (N, M) array share the same style and label

    left[3] labels: (optional) iterable of strings as long as ydata

    right: tuple returning the data for the secondary (right) axis

  • *args – All other positional parameters are sent to the

Keyword Arguments:
  • s_range – Lattice range of interest, default: unchanged, initially set to the full cell.

  • axes (tuple[Axes, Optional[Axes]) – Axes for plotting as (primary_axes, secondary_axes). Default: create new axes

  • slices (int) – Number of slices. Default: 400

  • legend (bool) – Show a legend on the plot. Default: True

  • labels (Refpts) – display the name of selected elements. Default: None

  • block (bool) – If True, block until the figure is closed. Default: False

  • dipole (dict) – Dictionary of properties overloading the default properties of dipole representation. See plot_synopt() for details

  • quadrupole (dict) – Same definition as for dipole

  • sextupole (dict) – Same definition as for dipole

  • multipole (dict) – Same definition as for dipole

  • monitor (dict) – Same definition as for dipole

  • **kwargs – All other keywords are sent to the plotting function

Returns:
  • left_axes (Axes) – Main (left) axes

  • right_axes (Axes) – Secondary (right) axes or None

  • synopt_axes (Axes) – Synoptic axes