Circuit Plot

Matplotlib based plotting of quantum circuits.


  • Optimize printing of large circuits.
  • Get this to work with single gates.
  • Do a better job checking the form of circuits to make sure it is a Mul of Gates.
  • Get multi-target gates plotting.
  • Get initial and final states to plot.
  • Get measurements to plot. Might need to rethink measurement as a gate issue.
  • Get scale and figsize to be handled in a better way.
  • Write some tests/examples!
class sympy.physics.quantum.circuitplot.CircuitPlot(c, nqubits, **kwargs)[source]

A class for managing a circuit plot.

control_line(gate_idx, min_wire, max_wire)[source]

Draw a vertical control line.

control_point(gate_idx, wire_idx)[source]

Draw a control point.

not_point(gate_idx, wire_idx)[source]

Draw a NOT gates as the circle with plus in the middle.

one_qubit_box(t, gate_idx, wire_idx)[source]

Draw a box for a single qubit gate.

swap_point(gate_idx, wire_idx)[source]

Draw a swap point as a cross.


Load the kwargs into the instance dict.

sympy.physics.quantum.circuitplot.circuit_plot(c, nqubits, **kwargs)[source]

Draw the circuit diagram for the circuit with nqubits.

Parameters :

c : circuit

The circuit to plot. Should be a product of Gate instances.

nqubits : int

The number of qubits to include in the circuit. Must be at least as big as the largest \(min_qubits`\) of the gates.

Previous topic


Next topic


This Page