Skip to main content

Draw Circuit

Haiqu.draw(circuit, style=”)

Render a quantum circuit. Intended to be used with the Haiqu Lab user interface. This function also returns the matplotlib figure object for use in haiqu.log() and other contexts.
  • Parameters:
    • circuit (QuantumCircuit | CircuitModel) — The quantum circuit to draw.
    • style (str) — The CSS class to use. The options are:
      • "" (default): neutral style
      • “haiqu_blue”: Haiqu blue
      • “haiqu_light”: Haiqu light
      • “haiqu_light2”: Haiqu light (alternative)
      • “haiqu_neutral”: Haiqu neutral
      • “haiqu_orange”: Haiqu orange
      • “haiqu_pink”: Haiqu pink
      • “neon”: classic yellow neon
      • “neutral”: Haiqu light grey
  • Returns: The rendered circuit figure.
  • Return type: matplotlib.figure.Figure

Examples

>>> haiqu.draw(circuit)
Use the returned figure to log the circuit diagram:
>>> fig = haiqu.draw(circuit)
>>> haiqu.log(fig, name="Look at this circuit!")