iplot_state_qsphere

iplot_state_qsphere(rho, figsize=None)[source]

Create a Q sphere representation.

Graphical representation of the input array, using a Q sphere for each eigenvalue.

Parameters
  • rho (array) – State vector or density matrix.

  • figsize (tuple) – Figure size in pixels.

Example

from qiskit import QuantumCircuit, BasicAer, execute
from qiskit.visualization import iplot_state_qsphere
%matplotlib inline

qc = QuantumCircuit(2, 2)
qc.h(0)
qc.cx(0, 1)
qc.measure([0, 1], [0, 1])

backend = BasicAer.get_backend('statevector_simulator')
job = execute(qc, backend).result()
iplot_state_qsphere(job.get_statevector(qc))