Dashboard Core — Visuals¶
Every visualization here is native (plain matplotlib/numpy) — no Qiskit
anywhere in this module. Aggregates
circuit_diagram and
state_visuals into the set Composer
actually renders.
import numpy as np
from dashboard_core.visuals import draw_circuit_figure, histogram_figure, qsphere_figure, bloch_multivector_figure
bell = np.array([1, 0, 0, 1]) / np.sqrt(2)
draw_circuit_figure([("h", 0), ("cx", 0, 1)], n_qubits=2).savefig("circuit.png")
histogram_figure({"00": 512, "11": 488}).savefig("histogram.png")
qsphere_figure(bell).savefig("qsphere.png")
bloch_multivector_figure(bell).savefig("bloch.png")
Same functions and signatures as
circuit_diagram/state_visuals
directly — this module just pins matplotlib's light style regardless of
any other module's global style changes (e.g. dense_evolution.registry
sets a dark background for its own diagnostic plots at import time).
visuals ¶
Every visualization here is native (plain matplotlib/numpy) -- no Qiskit anywhere in this module. The circuit diagram was already native (dashboard_core.circuit_diagram); histogram/Q-sphere/Bloch spheres are now native too (dashboard_core.state_visuals), replacing qiskit.visualization.{plot_histogram, plot_state_qsphere, plot_bloch_multivector} -- the last Qiskit call sites this dashboard had. Qiskit's macOS instability was never proven scoped to just QuantumCircuit (see circuit_diagram.py's own docstring), so making these three merely "optional" instead of actually removing Qiskit would have left the same open question for a different set of functions; there's no reason left to keep it as a dependency here at all.
draw_circuit_figure ¶
Native matplotlib circuit diagram (dashboard_core.circuit_diagram).
Examples:
>>> from dashboard_core.visuals import draw_circuit_figure
>>> fig = draw_circuit_figure([('h', 0), ('cx', 0, 1)], n_qubits=2)
>>> type(fig).__name__
'Figure'
Source code in tools/dashboard/core/visuals.py
histogram_figure ¶
Native shot-count histogram (dashboard_core.state_visuals). statevector (optional): color bars by amplitude phase instead of a flat color -- see native_histogram_figure's own docstring.
Source code in tools/dashboard/core/visuals.py
qsphere_figure ¶
Native Q-sphere (dashboard_core.state_visuals) -- the multi-qubit generalization of the Bloch sphere used by IBM Quantum Composer.
Source code in tools/dashboard/core/visuals.py
bloch_multivector_figure ¶
Native per-qubit Bloch spheres (dashboard_core.state_visuals).
energy_landscape_figure ¶
energy_landscape_figure(
values_i,
values_j,
energies,
param_i,
param_j,
converged_i,
converged_j,
converged_energy,
)
Contour plot of a real VQE energy landscape scan (dashboard_core. vqe.scan_hardware_efficient_energy_landscape) over two parameters, with the converged optimum marked at its actual (converged_i, converged_j) coordinates -- not assumed to sit at the grid's center, since the caller decides the scan range independently.
Source code in tools/dashboard/core/visuals.py
zne_bar_figure ¶
zne_bar_figure(
noise_factors,
noisy_expectations,
noisy_sems,
zne_extrapolated,
ideal_expectation,
)
Real ZNE measurement chart with a +-1 SEM (standard error of the mean, not the raw per-trial spread) band around each measured point -- the Monte Carlo uncertainty on run_zne_mitigation's own n_trials-averaged expectation values, not a decorative estimate.
Source code in tools/dashboard/core/visuals.py
qec_syndrome_map_figure ¶
Real syndrome-measurement map: physical qubits laid out in a line, each stabilizer drawn as a bracket connecting the qubits it acts on (its own non-identity Pauli positions), colored red if its syndrome bit is 1 (anticommutes / detected, from dense_evolution's own compute_syndrome output) or gray if 0 (commutes / undetected) -- not a schematic, the real per-stabilizer outcome. Qubits touched by pauli_error (if given) are marked filled and labeled with their Pauli letter.