Skip to main contentIBM Quantum Documentation
This page is from an old version of Qiskit SDK Go to the latest version
Important

IBM Quantum Platform is moving and this version will be sunset on July 1. To get started on the new platform, read the migration guide.

plot_bloch_multivector

plot_bloch_multivector(rho, title='', figsize=None)

GitHub

Plot the Bloch sphere.

Plot a sphere, axes, the Bloch vector, and its projections onto each axis.

Parameters

  • rho (ndarray) – Numpy array for state vector or density matrix.
  • title (str) – a string that represents the plot title
  • figsize (tuple) – Has no effect, here for compatibility only.

Returns

A matplotlib figure instance.

Return type

matplotlib.Figure

Raises

ImportError – Requires matplotlib.

Example

from qiskit import QuantumCircuit, BasicAer, execute
from qiskit.visualization import plot_bloch_multivector
%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()
plot_bloch_multivector(job.get_statevector(qc), title="New Bloch Multivector")

../_images/qiskit.visualization.plot_bloch_multivector_0_3.png ../_images/qiskit.visualization.plot_bloch_multivector_0_4.png

Was this page helpful?
Report a bug or request content on GitHub.