PlotStyle¶
- class PlotStyle[source]¶
A stylesheet for
BasePlotter
andBaseDrawer
.This style class is used by
BasePlotter
andBaseDrawer
. The default style for Qiskit Experiments is defined indefault_style()
. Style parameters are stored as dictionary entries, grouped by graphics or figure component. For example, style parameters relating to textboxes have the prefixtextbox_
. For default style parameter names and their values, see thedefault_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
- __getitem__(key, /)¶
Return self[key].
- __len__()¶
Return len(self).
- clear() None. Remove all items from D. ¶
- copy() a shallow copy of D ¶
- classmethod default_style()[source]¶
The default style across Qiskit Experiments.
The following is a description of the default style parameters are what they are used for.
- Style Parameters:
figsize (Tuple[int,int]) – The size of the figure
(width, height)
, in inches.legend_loc (Optional[str]) – The location of the legend in axis coordinates. If None, location is automatically determined by the drawer.
tick_label_size (int) – The font size for tick labels.
axis_label_size (int) – The font size for axis labels.
symbol_size (float) – The size of symbols for points/markers, proportional to the area of the drawn graphic.
errorbar_capsize (float) – The size of end-caps for error-bars.
textbox_rel_pos (Tuple[float,float]) – The relative position
(horizontal, vertical)
of textboxes, as a percentage of the canvas dimensions.textbox_text_size (int) – The font size for textboxes.
- Returns:
The default plot style used by Qiskit Experiments.
- Return type:
- fromkeys(value=None, /)¶
Create a new dictionary with keys from iterable and values set to value.
- get(key, default=None, /)¶
Return the value for key if key is in the dictionary, else default.
- items() a set-like object providing a view on D's items ¶
- keys() a set-like object providing a view on D's keys ¶
- classmethod merge(style1, style2)[source]¶
Merge
style2
intostyle1
as a new PlotStyle instance.This method merges an additional style
style2
into a base instancestyle1
, returning the merged style instance instead of modifying the inputs.
- pop(k[, d]) v, remove specified key and return the corresponding value. ¶
If the key is not found, return the default if given; otherwise, raise a KeyError.
- popitem()¶
Remove and return a (key, value) pair as a 2-tuple.
Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.
- setdefault(key, default=None, /)¶
Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
- update([E, ]**F) None. Update D from dict/iterable E and 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]
- values() an object providing a view on D's values ¶