qcodes.dataset.plotting

This plotting module provides various functions to plot the data measured using QCoDeS.

qcodes.dataset.plotting.plot_2d_scatterplot(x: numpy.ndarray, y: numpy.ndarray, z: numpy.ndarray, ax: matplotlib.axes._axes.Axes, colorbar: Optional[matplotlib.colorbar.Colorbar] = None, **kwargs: Any) Tuple[matplotlib.axes._axes.Axes, matplotlib.colorbar.Colorbar][source]

Make a 2D scatterplot of the data. **kwargs are passed to matplotlib’s scatter used for the plotting. By default the data will be rasterized in any vector plot if more than 5000 points are supplied. This can be overridden by supplying the rasterized kwarg.

Parameters
  • x – The x values

  • y – The y values

  • z – The z values

  • ax – The axis to plot onto

  • colorbar – The colorbar to plot into

Returns

The matplotlib axis handles for plot and colorbar

qcodes.dataset.plotting.plot_by_id(run_id: int, axes: Optional[Union[matplotlib.axes._axes.Axes, Sequence[matplotlib.axes._axes.Axes]]] = None, colorbars: Optional[Union[matplotlib.colorbar.Colorbar, Sequence[matplotlib.colorbar.Colorbar]]] = None, rescale_axes: bool = True, auto_color_scale: Optional[bool] = None, cutoff_percentile: Optional[Union[Tuple[float, float], float]] = None, complex_plot_type: str = 'real_and_imag', complex_plot_phase: str = 'radians', **kwargs: Any) Tuple[List[matplotlib.axes._axes.Axes], List[Optional[matplotlib.colorbar.Colorbar]]][source]

Construct all plots for a given run_id. Here run_id is an alias for captured_run_id for historical reasons. See the docs of load_by_run_spec() for details of loading runs. All other arguments are forwarded to plot_dataset(), see this for more details.

qcodes.dataset.plotting.plot_dataset(dataset: qcodes.dataset.data_set_protocol.DataSetProtocol, axes: Optional[Union[matplotlib.axes._axes.Axes, Sequence[matplotlib.axes._axes.Axes]]] = None, colorbars: Optional[Union[matplotlib.colorbar.Colorbar, Sequence[matplotlib.colorbar.Colorbar]]] = None, rescale_axes: bool = True, auto_color_scale: Optional[bool] = None, cutoff_percentile: Optional[Union[Tuple[float, float], float]] = None, complex_plot_type: str = 'real_and_imag', complex_plot_phase: str = 'radians', **kwargs: Any) Tuple[List[matplotlib.axes._axes.Axes], List[Optional[matplotlib.colorbar.Colorbar]]][source]

Construct all plots for a given dataset

Implemented so far:
  • 1D line and scatter plots

  • 2D plots on filled out rectangular grids

  • 2D scatterplots (fallback)

The function can optionally be supplied with a matplotlib axes or a list of axes that will be used for plotting. The user should ensure that the number of axes matches the number of datasets to plot. To plot several (1D) dataset in the same axes supply it several times. Colorbar axes are created dynamically. If colorbar axes are supplied, they will be reused, yet new colorbar axes will be returned.

The plot has a title that comprises run id, experiment name, and sample name.

**kwargs are passed to matplotlib’s relevant plotting functions By default the data in any vector plot will be rasterized for scatter plots and heatmaps if more than 5000 points are supplied. This can be overridden by supplying the rasterized kwarg.

Parameters
  • dataset – The dataset to plot

  • axes – Optional Matplotlib axes to plot on. If not provided, new axes will be created

  • colorbars – Optional Matplotlib Colorbars to use for 2D plots. If not provided, new ones will be created

  • rescale_axes – If True, tick labels and units for axes of parameters with standard SI units will be rescaled so that, for example, ‘0.00000005’ tick label on ‘V’ axis are transformed to ‘50’ on ‘nV’ axis (‘n’ is ‘nano’)

  • auto_color_scale – If True, the colorscale of heatmap plots will be automatically adjusted to disregard outliers.

  • cutoff_percentile – Percentile of data that may maximally be clipped on both sides of the distribution. If given a tuple (a,b) the percentile limits will be a and 100-b. See also the plotting tuorial notebook.

  • complex_plot_type – Method for converting complex-valued parameters into two real-valued parameters, either "real_and_imag" or "mag_and_phase". Applicable only for the cases where the dataset contains complex numbers

  • complex_plot_phase – Format of phase for plotting complex-valued data, either "radians" or "degrees". Applicable only for the cases where the dataset contains complex numbers

Returns

A list of axes and a list of colorbars of the same length. The colorbar axes may be None if no colorbar is created (e.g. for 1D plots)

Config dependencies: (qcodesrc.json)

qcodes.dataset.plotting.plot_on_a_plain_grid(x: numpy.ndarray, y: numpy.ndarray, z: numpy.ndarray, ax: matplotlib.axes._axes.Axes, colorbar: Optional[matplotlib.colorbar.Colorbar] = None, **kwargs: Any) Tuple[matplotlib.axes._axes.Axes, matplotlib.colorbar.Colorbar][source]

Plot a heatmap of z using x and y as axes. Assumes that the data are rectangular, i.e. that x and y together describe a rectangular grid. The arrays of x and y need not be sorted in any particular way, but data must belong together such that z[n] has x[n] and y[n] as setpoints. The setpoints need not be equidistantly spaced, but linear interpolation is used to find the edges of the plotted squares. **kwargs are passed to matplotlib’s pcolormesh used for the plotting. By default the data in any vector plot will be rasterized if more that 5000 points are supplied. This can be overridden by supplying the rasterized kwarg.

Parameters
  • x – The x values

  • y – The y values

  • z – The z values

  • ax – The axis to plot onto

  • colorbar – A colorbar to reuse the axis for

Returns

The matplotlib axes handle for plot and colorbar