diff --git a/qiskit/visualization/matplotlib.py b/qiskit/visualization/matplotlib.py index e4a0fb22235f..6fa719bb4d59 100644 --- a/qiskit/visualization/matplotlib.py +++ b/qiskit/visualization/matplotlib.py @@ -346,7 +346,9 @@ def _get_colors(self, op): else: ec = self._style.edge_color lc = self._style.lc - if op.name == 'reset': + if op.name in self._style.gt: + gt = self._style.gt[op.name] + elif op.name == 'reset': gt = self._style.not_gate_lc else: gt = self._style.gt diff --git a/qiskit/visualization/qcstyle.py b/qiskit/visualization/qcstyle.py index b7200c44ff3a..2cf6cfc16301 100644 --- a/qiskit/visualization/qcstyle.py +++ b/qiskit/visualization/qcstyle.py @@ -22,21 +22,71 @@ class DefaultStyle: def __init__(self): # Set colors - basis_color = '#FA74A6' # Red - clifford_color = '#6FA4FF' # Blue - non_gate_color = '#000000' # Black - other_color = '#BB8BFF' # Purple - pauli_color = '#05BAB6' # Green - iden_color = '#05BAB6' # Green + other_color = '#9D1C54' + hadamard_color = '#f84f5a' + classical_color = '#06329A' + phase_color= '#3CB3FC' + nonunit_color = '#A8A8A8' + quantum_color = '#9D1C54' + + white_text = '#ffffff' + other_text = '#000000' self.name = 'iqx' self.tc = '#000000' - self.sc = '#000000' + self.gt = { + 'h': other_text, + + 'x': white_text, + 'cx': white_text, + 'ccx': white_text, + 'swap': white_text, + 'cswap': white_text, + 'iswap': white_text, + + 't': other_text, + 'tdg': other_text, + 's': other_text, + 'sdg': other_text, + 'z': other_text, + 'u1': other_text, + + 'meas': other_text, + 'measure': other_text, + 'reset': other_text, + + + 'u0': white_text, + 'u2': white_text, + 'u3': white_text, + 'id': white_text, + 'y': white_text, + 'cy': white_text, + 'cz': white_text, + + + 'r': white_text, + 'rx': white_text, + 'ry': white_text, + 'rz': white_text, + 'rxx': white_text, + 'ryy': white_text, + 'rzx': white_text, + 'rzz': white_text, + 'ch': white_text, + 'crx': white_text, + 'cry': white_text, + 'crz': white_text, + + 'target': other_text, + 'multi': other_text, + + } + self.sc = white_text self.lc = '#000000' self.not_gate_lc = '#ffffff' self.cc = '#778899' # Medium Gray self.gc = other_color - self.gt = '#000000' self.bc = '#bdbdbd' # Dark Gray self.bg = '#ffffff' self.edge_color = None @@ -76,37 +126,52 @@ def __init__(self): 'initialize': '$|\\psi\\rangle$' } self.dispcol = { - 'u0': basis_color, - 'u1': basis_color, - 'u2': basis_color, - 'u3': basis_color, - 'id': iden_color, - 'x': pauli_color, - 'y': pauli_color, - 'z': pauli_color, - 'h': clifford_color, - 'cx': clifford_color, - 'cy': clifford_color, - 'cz': clifford_color, - 'swap': clifford_color, - 's': clifford_color, - 'sdg': clifford_color, - 'dcx': clifford_color, - 'iswap': clifford_color, - 't': other_color, - 'tdg': other_color, - 'r': other_color, - 'rx': other_color, - 'ry': other_color, - 'rz': other_color, - 'rxx': other_color, - 'ryy': other_color, - 'rzx': other_color, - 'reset': non_gate_color, + 'h': hadamard_color, + + 'x': classical_color, + 'cx': classical_color, + 'ccx': classical_color, + 'swap': classical_color, + 'cswap': classical_color, + 'iswap': classical_color, + + 't': phase_color, + 'tdg': phase_color, + 's': phase_color, + 'sdg': phase_color, + 'z': phase_color, + 'u1': phase_color, + + 'meas': nonunit_color, + 'measure': nonunit_color, + 'reset': nonunit_color, + + + 'u0': quantum_color, + 'u2': quantum_color, + 'u3': quantum_color, + 'id': quantum_color, + 'y': quantum_color, + 'cy': quantum_color, + 'cz': quantum_color, + + + 'r': quantum_color, + 'rx': quantum_color, + 'ry': quantum_color, + 'rz': quantum_color, + 'rxx': quantum_color, + 'ryy': quantum_color, + 'rzx': quantum_color, + 'rzz': quantum_color, + 'ch': quantum_color, + 'crx': quantum_color, + 'cry': quantum_color, + 'crz': quantum_color, + 'target': '#ffffff', 'multi': other_color, - 'meas': non_gate_color, - 'measure': non_gate_color + } self.latexmode = False self.index = False