Skip to main content

Draw Circuit

Haiqu.draw(circuit, style=”, return_artifact=False)

Render a quantum circuit. Intended to be used with the Haiqu Lab user interface. With return_artifact=True, this function returns the matplotlib figure object for use in haiqu.log() and other contexts instead of rendering the circuit.
  • 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
    • return_artifact (bool) — Return the figure instead of rendering the circuit.
  • Returns: The circuit figure if return_artifact : is True, otherwise None.
  • Return type: matplotlib.figure.Figure | None

Examples

Use the returned figure to log the circuit diagram: