qiskit.visualization.plot_bloch_multivector
plot_bloch_multivector(state, title='', figsize=None, *, rho=None)
Plot the Bloch sphere.
Plot a sphere, axes, the Bloch vector, and its projections onto each axis.
Parameters
- state (Statevector orDensityMatrix 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")
Was this page helpful?
Report a bug or request content on GitHub.