Skip to main content

Backend-agnostic quantum circuit drawing library with Matplotlib as the first renderer.

Project description

Quantum Circuit Drawer — neon logo with a circuit-style atom icon and glowing typography (transparent background)

quantum-circuit-drawer

PyPI version Python versions CI License: MIT

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

Runnable example scripts live in examples/, with more detail in examples/README.md.

Project links

License

This project is distributed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quantum_circuit_drawer-0.2.1.tar.gz (145.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quantum_circuit_drawer-0.2.1-py3-none-any.whl (117.3 kB view details)

Uploaded Python 3

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

Hashes for quantum_circuit_drawer-0.2.1.tar.gz
Algorithm Hash digest
SHA256 ee9a87bf76f5e051122ab6b474989a239b5e317dec6f89926fe6bb85d3c7d85e
MD5 eff11e9f661743f2c1c939f97146d812
BLAKE2b-256 341a39301c453dc06a584b292cc1f899c9bf3726811c1c49280eb348ecaf8831

See more details on using hashes here.

File details

Details for the file quantum_circuit_drawer-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for quantum_circuit_drawer-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4a53f5547254613e14c9cadc4d43bcbc22335a9d43eabdbe689a7d15d0297bee
MD5 513f68c501254f8a0423c85e2c95008a
BLAKE2b-256 e8cb166bdb764772f509f013f5f666e900b0311846f1f50eed0336e3df7d5e3f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page