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.

PlotStyle

class PlotStyle[source]

A stylesheet for BasePlotter and BaseDrawer.

This style class is used by BasePlotter and BaseDrawer. The default style for Qiskit Experiments is defined in default_style(). Style parameters are stored as dictionary entries, grouped by graphics or figure component. For example, style parameters relating to textboxes have the prefix textbox_. For default style parameter names and their values, see the default_style() method.

Example

# Create custom style
custom_style = PlotStyle(
    {
        "legend_loc": "upper right",
        "textbox_rel_pos": (1, 1),
        "textbox_text_size": 14,
    }
)

# Create full style instance by combining with default style.
full_style = PlotStyle.merge(PlotStyle.default_style(), custom_style)

## Query style parameters
# Returns "upper right"
full_style["legend_loc"]
# Returns the value provided in ``PlotStyle.default_style()``
full_style["axis_label_size"]

Methods

PlotStyle.__getitem__

x.__getitem__(y) <==> x[y]

PlotStyle.__len__()

Return len(self).

PlotStyle.clear()

PlotStyle.copy()

PlotStyle.default_style()

The default style across Qiskit Experiments.

PlotStyle.fromkeys([value])

Create a new dictionary with keys from iterable and values set to value.

PlotStyle.get(key[, default])

Return the value for key if key is in the dictionary, else default.

PlotStyle.items()

PlotStyle.keys()

PlotStyle.merge(style1, style2)

Merge style2 into style1 as a new PlotStyle instance.

PlotStyle.pop(k[,d])

If key is not found, d is returned if given, otherwise KeyError is raised

PlotStyle.popitem()

Remove and return a (key, value) pair as a 2-tuple.

PlotStyle.setdefault(key[, default])

Insert key with a value of default if key is not in the dictionary.

PlotStyle.update([E, ]**F)

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

PlotStyle.values()

PlotStyle.__len__()

Return len(self).

PlotStyle.__getitem__

x.__getitem__(y) <==> x[y]