Backend-agnostic quantum circuit drawing library with Matplotlib as the first renderer.
Project description
quantum-circuit-drawer
quantum-circuit-drawer is a small Python library for drawing quantum circuits from different ecosystems with one consistent Matplotlib-based visual style.
It gives you one public entry point, draw_quantum_circuit(...), for supported Qiskit, Cirq, PennyLane, MyQLM, CUDA-Q, and internal IR inputs. The goal is simple: keep your visualization code stable even when the circuit source changes.
Why this library
Quantum frameworks do not all expose the same drawing workflow. This project focuses on the visualization layer, so you can:
- keep the same look across different circuit frameworks
- save circuit diagrams for reports, notebooks, and documentation
- draw into your own Matplotlib figures when you need larger layouts
- use one typed API instead of several framework-specific drawing calls
Supported inputs
| Input path | Install | Typical object | Notes |
|---|---|---|---|
| Internal IR | python -m pip install quantum-circuit-drawer |
CircuitIR |
Included in the base package |
| Qiskit | python -m pip install "quantum-circuit-drawer[qiskit]" |
qiskit.QuantumCircuit |
Good default if you mainly use Qiskit |
| Cirq | python -m pip install "quantum-circuit-drawer[cirq]" |
cirq.Circuit |
Works with explicit or automatic framework detection |
| PennyLane | python -m pip install "quantum-circuit-drawer[pennylane]" |
tape-like objects | Supports QuantumTape, QuantumScript, and wrappers exposing .qtape or .tape |
| MyQLM | python -m pip install "quantum-circuit-drawer[myqlm]" |
qat.core.Circuit |
Convert from Program().to_circ() first |
| CUDA-Q | python -m pip install "quantum-circuit-drawer[cudaq]" |
closed CUDA-Q kernels | Linux or WSL2 oriented |
Install
Install the base package inside your virtual environment:
python -m pip install quantum-circuit-drawer
Install the framework extra you need, for example Qiskit:
python -m pip install "quantum-circuit-drawer[qiskit]"
For notebooks, install Jupyter tools in the same environment:
python -m pip install jupyter ipykernel
See the full installation guide for Windows PowerShell commands, Linux/WSL commands, optional extras, CUDA-Q notes, and local editable installs.
Basic usage
from qiskit import QuantumCircuit
from quantum_circuit_drawer import draw_quantum_circuit
circuit = QuantumCircuit(2, 1)
circuit.h(0)
circuit.cx(0, 1)
circuit.measure(1, 0)
figure, axes = draw_quantum_circuit(circuit)
By default, the library detects the circuit framework, creates a Matplotlib figure, uses the built-in dark theme, and shows the figure when the active Matplotlib backend is interactive.
For script-friendly output:
draw_quantum_circuit(circuit, output="bell.png", show=False)
Documentation
- Documentation index: the full map.
- Getting started: the shortest first successful example.
- Installation: virtual environments, extras, notebooks, and local installs.
- API reference:
draw_quantum_circuit(...), style options, return values, and exceptions. - User guide: workflows, examples, tips, 2D/3D views, sliders, and reports.
- Frameworks: Qiskit, Cirq, PennyLane, MyQLM, CUDA-Q, and internal IR notes.
- Recipes: copy-paste solutions for common tasks.
- Troubleshooting: common errors and fixes.
- Development: local checks, build commands, and benchmark notes.
Runnable example scripts live in examples/, with more detail in examples/README.md.
Project links
- Repository: github.com/DOKOS-TAYOS/quantum-circuit-drawer
- Issue tracker: github.com/DOKOS-TAYOS/quantum-circuit-drawer/issues
- Changelog: CHANGELOG.md
License
This project is distributed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file quantum_circuit_drawer-0.2.1.tar.gz.
File metadata
- Download URL: quantum_circuit_drawer-0.2.1.tar.gz
- Upload date:
- Size: 145.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee9a87bf76f5e051122ab6b474989a239b5e317dec6f89926fe6bb85d3c7d85e
|
|
| MD5 |
eff11e9f661743f2c1c939f97146d812
|
|
| BLAKE2b-256 |
341a39301c453dc06a584b292cc1f899c9bf3726811c1c49280eb348ecaf8831
|
File details
Details for the file quantum_circuit_drawer-0.2.1-py3-none-any.whl.
File metadata
- Download URL: quantum_circuit_drawer-0.2.1-py3-none-any.whl
- Upload date:
- Size: 117.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a53f5547254613e14c9cadc4d43bcbc22335a9d43eabdbe689a7d15d0297bee
|
|
| MD5 |
513f68c501254f8a0423c85e2c95008a
|
|
| BLAKE2b-256 |
e8cb166bdb764772f509f013f5f666e900b0311846f1f50eed0336e3df7d5e3f
|