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_vector

plot_bloch_vector(bloch, title='', ax=None, figsize=None)

GitHub

Plot the Bloch sphere.

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

Parameters

  • bloch (list[double]) – array of three elements where [<x>, <y>, <z>]
  • title (str) – a string that represents the plot title
  • ax (matplotlib.axes.Axes) – An Axes to use for rendering the bloch sphere
  • figsize (tuple) – Figure size in inches. Has no effect is passing ax.

Returns

A matplotlib figure instance if ax = None.

Return type

Figure

Raises

ImportError – Requires matplotlib.

Example

from qiskit.visualization import plot_bloch_vector
%matplotlib inline
 
plot_bloch_vector([0,1,0], title="New Bloch Sphere")

../_images/qiskit.visualization.plot_bloch_vector_0_2.png ../_images/qiskit.visualization.plot_bloch_vector_0_3.png

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