Skip to main contentIBM Quantum Documentation
This page is from an old version of Qiskit SDK and does not exist in the latest version. We recommend you migrate to the latest version. See the release notes for more information.

qiskit.visualization.qcstyle.DefaultStyle

class DefaultStyle

GitHub

Creates a Default Style dictionary

Style Dict Details

The style dict contains numerous options that define the style of the output circuit visualization. The style dict is only used by the mpl output. The options available in the style dict are defined below:

name (str): the name of the style. The name can be set to iqx,

bw, default, or the name of a user-created json file. This overrides the setting in the user config file (usually ~/.qiskit/settings.conf).

textcolor (str): the color code to use for all text not inside a gate.

Defaults to #000000

subtextcolor (str): the color code to use for subtext. Defaults to

#000000

linecolor (str): the color code to use for lines. Defaults to

#000000

creglinecolor (str): the color code to use for classical register

lines. Defaults to #778899

gatetextcolor (str): the color code to use for gate text. Defaults to

#000000

gatefacecolor (str): the color code to use for a gate if no color

specified in the ‘displaycolor’ dict. Defaults to #BB8BFF

barrierfacecolor (str): the color code to use for barriers. Defaults to

#BDBDBD

backgroundcolor (str): the color code to use for the background.

Defaults to #FFFFFF

edgecolor (str): the color code to use for gate edges when using the

bw style. Defaults to #000000.

fontsize (int): the font size to use for text. Defaults to 13.

subfontsize (int): the font size to use for subtext. Defaults to 8.

showindex (bool): if set to True, show the index numbers at the top.

Defaults to False.

figwidth (int): the maximum width (in inches) for the output figure.

If set to -1, the maximum displayable width will be used. Defaults to -1.

dpi (int): the DPI to use for the output image. Defaults to 150.

margin (list): a list of margin values to adjust spacing around output

image. Takes a list of 4 ints: [x left, x right, y bottom, y top]. Defaults to [2.0, 0.1, 0.1, 0.3].

creglinestyle (str): The style of line to use for classical registers.

Choices are solid, doublet, or any valid matplotlib linestyle kwarg value. Defaults to doublet.

displaytext (dict): a dictionary of the text to use for certain element

types in the output visualization. These items allow the use of LaTeX formatting for gate names. The ‘displaytext’ dict can contain any number of elements from one to the entire dict above.The default values are (default.json):

{
    'u1': '$\mathrm{U}_1$',
    'u2': '$\mathrm{U}_2$',
    'u3': '$\mathrm{U}_3$',
    'u': 'U',
    'p': 'P',
    'id': 'I',
    'x': 'X',
    'y': 'Y',
    'z': 'Z',
    'h': 'H',
    's': 'S',
    'sdg': '$\mathrm{S}^\dagger$',
    'sx': '$\sqrt{\mathrm{X}}$',
    'sxdg': '$\sqrt{\mathrm{X}}^\dagger$',
    't': 'T',
    'tdg': '$\mathrm{T}^\dagger$',
    'dcx': 'Dcx',
    'iswap': 'Iswap',
    'ms': 'MS',
    'r': 'R',
    'rx': '$\mathrm{R}_\mathrm{X}$',
    'ry': '$\mathrm{R}_\mathrm{Y}$',
    'rz': '$\mathrm{R}_\mathrm{Z}$',
    'rxx': '$\mathrm{R}_{\mathrm{XX}}$',
    'ryy': '$\mathrm{R}_{\mathrm{YY}}$',
    'rzx': '$\mathrm{R}_{\mathrm{ZX}}$',
    'rzz': '$\mathrm{R}_{\mathrm{ZZ}}$',
    'reset': '$\left|0\right\rangle$',
    'initialize': '$|\psi\rangle$'
}

displaycolor (dict): the color codes to use for each circuit element in

the form (gate_color, text_color). Colors can also be entered without the text color, such as ‘u1’: ‘#FA74A6’, in which case the text color will always be gatetextcolor. The displaycolor dict can contain any number of elements from one to the entire dict above. The default values are (default.json):

{
    'u1': ('#FA74A6', '#000000'),
    'u2': ('#FA74A6', '#000000'),
    'u3': ('#FA74A6', '#000000'),
    'id': ('#05BAB6', '#000000'),
    'u': ('#BB8BFF', '#000000'),
    'p': ('#BB8BFF', '#000000'),
    'x': ('#05BAB6', '#000000'),
    'y': ('#05BAB6', '#000000'),
    'z': ('#05BAB6', '#000000'),
    'h': ('#6FA4FF', '#000000'),
    'cx': ('#6FA4FF', '#000000'),
    'ccx': ('#BB8BFF', '#000000'),
    'mcx': ('#BB8BFF', '#000000'),
    'mcx_gray': ('#BB8BFF', '#000000'),
    'cy': ('#6FA4FF', '#000000'),
    'cz': ('#6FA4FF', '#000000'),
    'swap': ('#6FA4FF', '#000000'),
    'cswap': ('#BB8BFF', '#000000'),
    'ccswap': ('#BB8BFF', '#000000'),
    'dcx': ('#6FA4FF', '#000000'),
    'cdcx': ('#BB8BFF', '#000000'),
    'ccdcx': ('#BB8BFF', '#000000'),
    'iswap': ('#6FA4FF', '#000000'),
    's': ('#6FA4FF', '#000000'),
    'sdg': ('#6FA4FF', '#000000'),
    't': ('#BB8BFF', '#000000'),
    'tdg': ('#BB8BFF', '#000000'),
    'sx': ('#BB8BFF', '#000000'),
    'sxdg': ('#BB8BFF', '#000000')
    'r': ('#BB8BFF', '#000000'),
    'rx': ('#BB8BFF', '#000000'),
    'ry': ('#BB8BFF', '#000000'),
    'rz': ('#BB8BFF', '#000000'),
    'rxx': ('#BB8BFF', '#000000'),
    'ryy': ('#BB8BFF', '#000000'),
    'rzx': ('#BB8BFF', '#000000'),
    'reset': ('#000000', '#FFFFFF'),
    'target': ('#FFFFFF', '#FFFFFF'),
    'measure': ('#000000', '#FFFFFF'),
}

__init__

__init__()

Initialize self. See help(type(self)) for accurate signature.


Methods

__init__()Initialize self.
Was this page helpful?
Report a bug or request content on GitHub.