plotting#

Module to plot artof data using plotly.

artof.plotting.create_heatmap(z_values, x0, dx, y0, dy, z_label)#

Create a heatmap.

Parameters:
  • z_values (list) – z values for the plot.

  • x0 (int | float) – Lower x edge for the plot.

  • dx (int | float) – x step size for the plot.

  • y0 (int | float) – Lower y edge for the plot.

  • dy (int | float) – y step size for the plot.

  • z_label (str) – Label for the colorbar.

Returns:

Heatmap from given data.

Return type:

Heatmap

artof.plotting.create_heatmap_frame(z_values, x0, dx, y0, dy, frame_value, z_label)#

Create a heatmap frame.

Parameters:
  • z_values (list) – z values for the plot.

  • x0 (int | float) – Lower x edge for the plot.

  • dx (int | float) – x step size for the plot.

  • y0 (int | float) – Lower y edge for the plot.

  • dy (int | float) – y step size for the plot.

  • frame_value (str | float | int) – Value of the frame.

  • z_label (str) – Label for the colorbar.

Returns:

Frame object containing the heatmap.

Return type:

frame

artof.plotting.create_scatter(x_values, y_values)#

Create a scatter plot.

Parameters:
  • x_values (list) – x values for the plot.

  • y_values (list) – y values for the plot.

Returns:

Scatter plot from given data.

Return type:

scatter

artof.plotting.create_scatter_frame(x_values, y_values, frame_value)#

Create a scatter plot frame.

Parameters:
  • x_values (list) – x values for the plot.

  • y_values (list) – y values for the plot.

  • frame_value (str | int | float) – Value of the frame.

Returns:

Frame object containing the scatter plot.

Return type:

frame

artof.plotting.get_axis_label(axis_name)#

Build string for matplotlib axis label including Greek characters.

Parameters:

axis_name (str) – String containing the axis label and unit separated by ‘_’.

Returns:

Formatted string for plotly.

Return type:

str

artof.plotting.get_counts_label(norm_modes, norm_step_size, new_line=False)#

Get label for counts axis based on normalization modes.

Parameters:
  • norm_modes (list[str]) – List of normalization modes applied to data.

  • norm_step_size (bool) – If True, step size normalization is applied, which is indicated in label.

  • new_line (bool) – If True, separate “Counts” and norm modes with a line break, else a space. Default is False.

Returns:

Formatted label for counts axis.

Return type:

str

artof.plotting.includes_energy_axis(axes, proj_axes)#

Check if the projection includes the energy axis.

Parameters:
  • axes (list) – List of axes.

  • proj_axes (list) – List of projection axes.

Returns:

Boolean indicating if the projection includes the energy axis.

Return type:

bool

artof.plotting.plot_1d(fig, data, ax_values, ax_labels, incident_energy)#

Plot in 1D.

Parameters:
  • fig (FigureWidget | Figure) – Figure object to plot on.

  • data (ndarray) – 1D array as y-values

  • ax_values (list[ndarray | list]) – list with one element - the x-values for the plot

  • ax_labels (list[str]) – List of two axis labels for x- and y-axis

  • incident_energy (float) – If incident energy is passed and one of the axis is the energy axis, the data will be plotted in binding energy scale.

artof.plotting.plot_2d_heatmap(fig, data, ax_values, ax_labels, incident_energy)#

Plot in 2D data as heatmap.

Parameters:
  • fig (FigureWidget | Figure) – Figure object to plot on.

  • data (ndarray) – 2D data

  • ax_values (list[ndarray | list]) – List of two lists axis values corresponding to data

  • ax_labels (list[str]) – List of two axis labels for x-, y- and z-axis

  • incident_energy (float | None) – If incident energy is passed and one of the axis is the energy axis, the data will be plotted in binding energy scale

artof.plotting.plot_2d_slider(fig, data, ax_values, ax_labels, incident_energy, height)#

Plot in 2D data as scatter plot with slider.

Parameters:
  • fig (FigureWidget | Figure) – Figure object to plot on.

  • data (ndarray) – 2D data, where first dimension will be displayed using slider, second in scatter plot

  • ax_values (list[ndarray | list]) – List of two lists axis values corresponding to data

  • ax_labels (list[str]) – List of three axis labels for slider-, x- and y-axis

  • incident_energy (float | None) – If incident energy is passed and one of the axis is the energy axis, the data will be plotted in binding energy scale

  • height (int) – Height of figure (needed for slider setup)

artof.plotting.plot_3d(fig, data, ax_values, ax_labels, incident_energy, height)#

Plot in 3D data as heatmap with slider.

Parameters:
  • fig (FigureWidget | Figure) – Figure object to plot on.

  • data (ndarray) – 3D data, where first dimension will be displayed using slider, other in heatmap

  • ax_values (list[ndarray | list]) – List of three lists axis values corresponding to data

  • ax_labels (list[str]) – List of three axis labels corresponding to slider, x-, y- and z-axis

  • incident_energy (float | None) – If incident energy is passed and one of the axis is the energy axis, the data will be plotted in binding energy scale

  • height (int) – Height of figure (needed for slider setup)

artof.plotting.plot_counts(fig, steps, counts, sum_iters)#

Plot counts.

Parameters:
  • fig (FigureWidget) – figure object to plot on.

  • iterations – x values for the plot.

  • counts (list[int]) – y values for the plot.

  • sum_iters (bool) – If True, set xlabel to “Iterations”, else set to “Steps”.

  • steps (list[int])

Return type:

None

artof.plotting.plot_data(fig, data, ax_names, ax_values, height, norm_modes=None, norm_step_size=False, incident_energy=None, title=None)#

Plot data in 1, 2 or 3 dimensions.

Parameters:
  • fig (FigureWidget | Figure) – Figure to plot on.

  • ax_names (list[str]) – Ordered list of axis names

  • ax_values (list[ndarray]) – Ordered lists of axis values

  • height (int) – height of figure

  • norm_modes (None | list[str]) – Normalization modes used for data, which are displayed in labels.

  • norm_step_size (bool) – Step size normalization is shown in label if True.

  • incident_energy (float) – If incident energy is passed and one of the axis is the energy axis, the data will be plotted in binding energy scale

  • title (str | None) – Title of figure.

  • data (ndarray)

artof.plotting.setup_animation_layout(fig, height, slider_values, ax_name)#

Setup layout for animation.

Parameters:
  • fig (Figure) – figure object to plot on.

  • height (int) – Height of plot.

  • slider_values (list[str]) – List of values for each frame of slider.

  • ax_name (str) – Name of animation axis.

Raises:

ValueError – If the figure is a FigureWidget. Animations only work with Figure.

Return type:

None

artof.plotting.update_subtitle(fig, subtitle)#

Update the subtitle of the figure.

Parameters:
  • fig (Figure) – Figure object to update.

  • subtitle (str) – Subtitle to set.

Return type:

None