MPL drawer support for complex custom instructions
See original GitHub issueThe following circuit is being draw like wrongly:
from qiskit.circuit import Gate, Parameter
qinst = QuantumRegister(1, 'q')
cinst = ClassicalRegister(1, 'c')
inst = QuantumCircuit(qinst, cinst, name='instruction').to_instruction()
qr = QuantumRegister(2, 'q')
cr = ClassicalRegister(2, 'c')
circuit = QuantumCircuit(qr, cr)
circuit.append(inst, [qr[0]], [cr[1]])
circuit.draw(output='mpl')
It should be similar to this: Considering the following custom instruction:
┌─────────────┐
q_0: |0>┤1 ├
│ │
q_1: |0>┤ ├
│ instruction │
c_0: 0 ╡ ╞
│ │
c_1: 0 ╡0 ╞
└─────────────┘
Additionally, based on the consensus in #3073, the mpl drawer should support controlled/conditional custom instructions. The following is an example for conditional:
from qiskit.circuit import Gate, Parameter
qinst = QuantumRegister(1, 'q')
cinst = ClassicalRegister(1, 'c')
inst = QuantumCircuit(qinst, cinst, name='instruction').to_instruction()
qr = QuantumRegister(2, 'q')
cr = ClassicalRegister(2, 'c')
circuit = QuantumCircuit(qr, cr)
circuit.append(inst, [qr[0]], [cr[1]]).c_if(cr, 2)
circuit.draw(output='mpl')
Controlled is not yet supported (see #2862).
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Learn How to Customize The Appearance of Your Qiskit ...
Learn How to Customize The Appearance of Your Qiskit Circuits (with Accessibility in Mind). Qiskit circuit drawer mosaic pattern. By Abby ...
Read more >qiskit - understanding QuantumCircuit.x() function
MPL drawer should prioritize instruction label over name #3766 When an instruction has a label, the label should be used.
Read more >qiskit.visualization.circuit_drawer
qiskit.visualization.circuit_drawer¶ ... Draw the quantum circuit. Use the output parameter to choose the drawing format: text: ASCII art TextDrawing that can be ...
Read more >Resources - Marshall Furniture
For simple assembly items, Marshall Furniture will provide your team with installation instructions. For a complex, custom assembly, a third-party installer may ...
Read more >Marker reference — Matplotlib 3.6.2 documentation
Matplotlib supports multiple categories of markers which are selected using the ... Use MathText, to use custom marker symbols, like e.g. "$\u266B$" ....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
hi, i think i have the solution for that , can you assign it to me so that i can look into it.
Hi apologies as I’ve been offline due to some personal reasons. Seems the issue is addressed as per #6339