-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
616c67e
commit 379c4e1
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
releasenotes/notes/dag_drawer_custom_style-ec99bd874858f6a6.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
features_visualization: | ||
- | | ||
Introduced custom styles for the dag_drawer() function. This allows you | ||
to pass a dictionary to the `style` parameter with custom attributes that | ||
changes the style of the DAG the function returns. For example:: | ||
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit | ||
from qiskit.converters import circuit_to_dag | ||
from qiskit.visualization import dag_drawer | ||
q = QuantumRegister(3, 'q') | ||
c = ClassicalRegister(3, 'c') | ||
circ = QuantumCircuit(q, c) | ||
circ.h(q[0]) | ||
circ.cx(q[0], q[1]) | ||
circ.measure(q[0], c[0]) | ||
circ.rz(0.5, q[1]).c_if(c, 2) | ||
dag = circuit_to_dag(circ) | ||
style = { | ||
"inputnodecolor": "pink", | ||
"outputnodecolor": "lightblue", | ||
"opnodecolor": "red", | ||
} | ||
dag_drawer(dag, style=style) | ||
fixes: | ||
- | | ||
Fixes a bug where `style=plain` did not show circuit labels for the nodes | ||
of the DAG. | ||