qiskit_ibm_runtime.visualization.draw_layer_errors_swarm
draw_layer_errors_swarm(layer_errors, num_bodies=None, max_rate=None, min_rate=None, connected=None, colors=None, num_bins=None, opacities=0.4, names=None, x_coo=None, marker_size=None, height=500, width=800)
Draw a swarm plot for the given list of layer errors.
This function plots the rates of each of the given layer errors along a vertical axes, offsetting the rates along the x axis to minimize the overlap between the markers. It helps visualizing the distribution of errors for different layer errors, as well as to track (using the connected argument) the evolution of specific generators across different layers.
To calculate the offsets, this arranges the rates in num_bins equally-spaced bins, and then it assigns the x coordinates so that all the rates in the same bins are spaced around the vertical axis. Thus, a higher value of num_bins will result in higher overlaps between the markers.
Parameters
- layer_errors (list[LayerError]) – The layer errors to draw.
- num_bodies (Optional[int]) – The weight of the generators to include in the plot, or
Noneif all the generators should be included. - max_rate (Optional[float]) – The largest rate to include in the plot, or
Noneif no upper limit should be set. - min_rate (Optional[float]) – The smallest rate to include in the plot, or
Noneif no lower limit should be set. - connected (Optional[list[Union[Pauli, str]]]) – A list of generators whose markers are to be connected by lines.
- colors (Optional[list[str]]) – A list of colors for the markers in the plot, or
Noneif these colors are to be chosen automatically. - num_bins (Optional[int]) – The number of bins to place the rates into when calculating the
x-axis offsets. - opacities (Union[float, list[float]]) – A list of opacities for the markers.
- names (Optional[list[str]]) – The names of the various layers as displayed in the legend. If
None, default names are assigned based on the layers’ position inside thelayer_errorslist. - x_coo (Optional[list[float]]) – The
x-axis coordinates of the vertical axes that the markers are drawn around, orNoneif these axes should be placed at regular intervals. - marker_size (Optional[float]) – The size of the marker in the plot.
- height (int) – The height of the returned figure.
- width (int) – The width of the returned figure.
Raises
- ValueError – If an invalid grouping option is given.
- ValueError – If
colorsis given but its length is incorrect.
Return type
PlotlyFigure