Open nonhermitian opened 2 months ago
Hi @nonhermitian! I want to know more about this feature, and then maybe I can work on this. I did some reading about both functions. The circuit_drawer function uses the "output" parameter and the "backgroundcolor" to add some colors to the graph.
The following code shows the usage of output parameter.
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
qc = QuantumCircuit(1, 1)
qc.h(0)
qc.measure(0, 0)
circuit_drawer(qc, output="mpl")
The following code shows the usage of style parameter with backgroundcolor specified (it gives a blue color for background).
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
qc = QuantumCircuit(1, 1)
qc.h(0)
qc.measure(0, 0)
circuit_drawer(qc, output="mpl", style={"backgroundcolor":"#0000FF"})
If we talk about the DAG circuit drawer now, which uses the function _dagdrawer, it does not have the output parameter, and relies only on the style parameter. The style parameter can take two values, plain and color.
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
from qiskit.dagcircuit import DAGCircuit
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)
dag_drawer(dag, style="color")
Now, you have mentioned that we should be able to change colors in the DAG drawer like the way we can do it in the circuit drawer function. So, are you talking about changing the background color? Thank You
I am interested in working on this, can I be assigned to this issue?
🙄😅 I had already started looking into this, and have asked a question here too. So I request you to let me work with you on this. Thank you
What should we add?
It would be nice if we can change colors for the DAG drawer in a similar manner to the circuit drawer