English
Languages
English
Japanese
German
Korean
Portuguese, Brazilian
French
Shortcuts

qiskit.visualization.plot_bloch_multivector

plot_bloch_multivector(state, title='', figsize=None, *, rho=None)[source]

Plot the Bloch sphere.

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

Parameters
  • state (Statevector or DensityMatrix or ndarray) – an N-qubit quantum state.

  • 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.

  • VisualizationError – if input is not a valid N-qubit state.

Example

from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector
from qiskit.visualization import plot_bloch_multivector
%matplotlib inline

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

state = Statevector.from_instruction(qc)
plot_bloch_multivector(state, title="New Bloch Multivector")
../_images/qiskit.visualization.plot_bloch_multivector_0_0.png ../_images/qiskit.visualization.plot_bloch_multivector_0_1.png