9.5.10. qumada.utils.plotting
- qumada.utils.plotting.get_parameter_name_by_label(dataset, label)[source]
Returns the parameter name for a given parameter label in a QCoDeS dataset.
- Parameters:
dataset (qcodes.dataset) – The QCoDeS dataset containing the parameters.
label (str) – The label of the parameter for which to find the name.
- Returns:
The name of the parameter corresponding to the provided label.
- Return type:
- Raises:
ValueError – If no parameter matches the label or if multiple parameters share the same label.
- qumada.utils.plotting.hysteresis(dataset, I_threshold=1.5e-11, parameter_name='lockin_current')[source]
- qumada.utils.plotting.plot_2D(x_data, y_data, z_data, fig=None, ax=None, x_label=None, y_label=None, z_label=None, scale_axis=True, *args, **kwargs)[source]
Plots 2D derivatives. Requires tuples of name and 1D arrays corresponding to x, y, and z data as input. Supports axis and colorbar scaling.
- Parameters:
x_data (tuple) – Tuples containing name, values, units, and labels of x, y, and z axes.
y_data (tuple) – Tuples containing name, values, units, and labels of x, y, and z axes.
z_data (tuple) – Tuples containing name, values, units, and labels of x, y, and z axes.
fig (matplotlib.figure.Figure, optional) – The figure object. Default is None.
ax (matplotlib.axes.Axes, optional) – The axis object. Default is None.
x_label (str, optional) – Custom axis labels. Default is None.
y_label (str, optional) – Custom axis labels. Default is None.
z_label (str, optional) – Custom axis labels. Default is None.
scale_axis (bool, optional) – If True, rescales axes and colorbar to use SI prefixes. Default is True.
*args – Additional arguments for flexibility.
**kwargs – Additional arguments for flexibility.
- Returns:
fig, ax – The figure and axis objects for further customization.
- Return type:
- qumada.utils.plotting.plot_2D_grad(x_data, y_data, z_data, *args, direction='both')[source]
Plots 2D derivatives. Requires tuples of name and 1D arrays corresponding to x, y and z data as input. Works well with QuMADA “get_parameter_data” method found in load_from_sqlite. direction argument can be x, y or z corresponding to the direction of the gradient used. “both” adds the gradients quadratically.
TODO: Add get_parameter_data method as default to call when no data is provided TODO: Add further image manipulation and line detection functionality
- qumada.utils.plotting.plot_2D_sec_derivative(x_data, y_data, z_data, *args)[source]
Plots second derivative of data. Requires tuples of name and 1D arrays corresponding to x, y and z data as input. Works well with QuMADA “get_parameter_data” method found in load_from_sqlite. direction argument can be x, y or z corresponding to the direction of the gradient used. “both” adds the gradients quadratically.
TODO: Add get_parameter_data method as default to call when no data is provided TODO: Add further image manipulation and line detection functionality
- qumada.utils.plotting.plot_multiple_datasets(datasets=None, x_axis_parameters_name=None, y_axis_parameters_name=None, plot_hysteresis=True, ax=None, fig=None, scale_axis=True, legend=True, exclude_string_from_legend=[], **kwargs)[source]
Plot multiple datasets from a QCoDeS database into a single figure.
This function supports plotting and can handle multiple datasets. It automatically manages axis labels, legends, and optionally rescales the axes to use appropriate SI prefixes (e.g., µA, mV) instead of scientific notation.
- Parameters:
datasets (list, optional) – List of QCoDeS datasets to plot. If None, the function allows you to pick measurements from the currently loaded QCoDeS database. Default is None.
x_axis_parameters_name (str, optional) – The name of the parameter to use for the x-axis. If None, you will be prompted to select it individually for each dataset if more than one parameter exists. Default is None.
y_axis_parameters_name (str, optional) – The name of the parameter to use for the y-axis. If None, you will be prompted to select it individually for each dataset if more than one parameter exists. Default is None.
plot_hysteresis (bool, optional) – If True, separates datasets with multiple sweeps into different curves based on the monotonicity of the x-axis data. For example, foresweep and backsweep can be plotted with distinct markers. Default is True.
ax (matplotlib.axes._axes.Axes, optional) – Matplotlib axis to plot on. If None, a new figure and axis will be created. Default is None.
fig (matplotlib.figure.Figure, optional) – Matplotlib figure object. Required if ax is provided. Default is None.
scale_axis (bool, optional) – If True, rescales the x- and y-axes to use SI prefixes (e.g., µ, m, k) instead of scientific notation for better readability. Default is True.
**kwargs (dict) –
- Additional keyword arguments for customizing the plot. For example:
font: int, font size for the plot.
marker: str, marker style for the data points.
markersize: int, size of the markers.
legend_fontsize: int, font size for the legend.
legend_markerscale: float, scale factor for legend markers.
- Returns:
ax – The axis object containing the plotted data.
- Return type:
matplotlib.axes._axes.Axes
Notes
This function assumes the input datasets are from QCoDeS and compatible with the get_parameter_data function.
Axis scaling is applied only when scale_axis is True, and the scaling factor is calculated based on the data range.
Monotonicity of the x-axis is used to detect and separate hysteresis loops.