Note
This is the documentation for the current state of the development branch of Qiskit Experiments. The documentation or APIs here can change prior to being released.
CurvePlotter¶
- class CurvePlotter(drawer)[source]¶
A plotter class to plot results from
CurveAnalysis
.CurvePlotter
plots results from curve fits, which includesRaw results as a scatter plot.
Processed results with standard deviations/confidence intervals.
Interpolated fit results from the curve analysis.
Confidence interval for the fit results.
A report on the performance of the fit.
Options
The following can be set using
set_options()
.- Options
Defined in the class
CurvePlotter
:plot_sigma (List[Tuple[float, float]])
Default value: [(1.0
,0.7
), (3.0
,0.3
)]A list of two number tuples showing the configuration to write confidence intervals for the fit curve. The first argument is the relative sigma (n_sigma), and the second argument is the transparency of the interval plot in[0, 1]
. Multiple n_sigma intervals can be drawn for the same curve.
Defined in the class
BasePlotter
:axis (Any)
Default value:None
Arbitrary object that can be used as a drawing canvas.subplots (Tuple[int, int])
Default value: (1
,1
)Number of rows and columns when the experimental result is drawn in the multiple windows.style (PlotStyle)
Default value: {}The style definition to use when plotting. This overwrites figure option custom_style set indrawer
. The default is an empty style object, and such the defaultdrawer
plotting style will be used.
Figure options
The following can be set using
set_figure_options()
.- Options
Defined in the class
CurvePlotter
:report_red_chi2_label (str)
Default value:"reduced-$\chi^2$"
The label for the reduced-chi squared entry of the fit report. Defaults to the Python string literal"reduced-$\\chi^2$"
, corresponding to the formatted string reduced- .
Defined in the class
BasePlotter
:xlabel (Union[str, List[str]])
Default value:None
X-axis label string of the output figure. If there are multiple columns in the canvas, this could be a list of labels.ylabel (Union[str, List[str]])
Default value:None
Y-axis label string of the output figure. If there are multiple rows in the canvas, this could be a list of labels.xlim (Tuple[float, float])
Default value:None
Min and max value of the horizontal axis. If not provided, it is automatically scaled based on the input data points.ylim (Tuple[float, float])
Default value:None
Min and max value of the vertical axis. If not provided, it is automatically scaled based on the input data points.xval_unit (str)
Default value:None
Unit of x values. No scaling prefix is needed here as this is controlled byxval_unit_scale
.yval_unit (str)
Default value:None
Unit of y values. Seexval_unit
for details.xval_unit_scale (bool)
Default value:True
Whether to add an SI unit prefix toxval_unit
if needed. For example, when the x values represent time andxval_unit="s"
,xval_unit_scale=True
adds an SI unit prefix to"s"
based on X values of plotted data. In the output figure, the prefix is automatically selected based on the maximum value in this axis. If your x values are in [1e-3, 1e-4], they are displayed as [1 ms, 10 ms]. By default, this option is set toTrue
. IfFalse
is provided, the axis numbers will be displayed in the scientific notation.yval_unit_scale (bool)
Default value:True
Whether to add an SI unit prefix toyval_unit
if needed. Seexval_unit_scale
for details.figure_title (str)
Default value:None
Title of the figure. Defaults to None, i.e. nothing is shown.series_params (Dict[SeriesName, Dict[str, Any]])
Default value: {}A dictionary of plot parameters for each series. This is keyed on the name for each series. Sub-dictionary is expected to have following three configurations, “canvas”, “color”, and “symbol”; “canvas” is the integer index of axis (when multi-canvas plot is set), “color” is the color of the curve, and “symbol” is the marker Style of the curve for scatter plots.
Initialization
Create a new plotter instance.
- Parameters:
drawer (
BaseDrawer
) – The drawer to use when creating the figure.
Attributes
Figure options for the plotter and its drawer.
Options for the plotter.
Series names that have been added to this plotter.
Data for series being plotted.
Additional data for the figure being plotted, that isn't associated with a series.
Methods
CurvePlotter.clear_series_data
([series_name])Clear series data for this plotter.
Clears supplementary data.
Return the config dictionary for this drawing.
CurvePlotter.data_exists_for
(series_name, ...)Returns whether the given data keys exist for the given series.
CurvePlotter.data_for
(series_name, data_keys)Returns data associated with the given series.
CurvePlotter.data_keys_for
(series_name)Returns a list of data keys for the given series.
Returns the expected series data keys supported by this plotter.
Returns the expected figures data keys supported by this plotter.
Generates and returns a figure for the already provided series and supplementary data.
CurvePlotter.set_figure_options
(**fields)Set the figure options.
CurvePlotter.set_options
(**fields)Set the plotter options.
CurvePlotter.set_series_data
(series_name, ...)Sets data for the given series.
Sets supplementary data for the plotter.