plot_num_paulis

plot_num_paulis(metadata, axes)[source]

Plot the number of Pauli terms.

This method populates the provided figure axes with a line-plot of the number of Pauli terms at each backpropagated slice. Below is an example where we plot some metadata which exists within our context.

>>> from matplotlib import pyplot as plt
>>> from qiskit_addon_obp.utils.visualization import plot_num_paulis
>>> fig, axes = plt.subplots(1, 1)
>>> plot_num_paulis(metadata, axes)
../_images/qiskit_addon_obp-utils-visualization-plot_num_paulis-2_00.png

Fig. 9 (png, hires.png, pdf)

../_images/qiskit_addon_obp-utils-visualization-plot_num_paulis-2_01.png

Fig. 10 (png, hires.png, pdf)

../_images/qiskit_addon_obp-utils-visualization-plot_num_paulis-2_02.png

Fig. 11 (png, hires.png, pdf)

As you can see in the figure above, the number of backpropagated slices is displayed along the x-axis. You can think of this as the “time” of the backpropagation algorithm. The number of Pauli terms at each backpropagation step is displayed along the y-axis. Since each observable is treated individually, they are plotted separately.

You can also find out the number of unique Pauli terms across all observables by using plot_sum_paulis().

Parameters:
  • metadata (OBPMetadata) – the metadata to be visualized.

  • axes (Axes) – the matplotlib axes in which to plot.