Skip to content

Commit

Permalink
Added plot bloch vector API reference code examples (Qiskit#8350)
Browse files Browse the repository at this point in the history
* changed plot_bloch_vector in API reference code examples to better showcase the different arguments

* Removed extra imports and matplotlib inline

* Added comments and removed figsize

* remove spaces around = in function arguments

Co-authored-by: Junye Huang <h.jun.ye@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 4, 2022
1 parent f206acc commit 316eaf5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions qiskit/visualization/state_visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,21 @@ def plot_bloch_vector(bloch, title="", ax=None, figsize=None, coord_type="cartes
Raises:
MissingOptionalLibraryError: Requires matplotlib.
Example:
Examples:
.. jupyter-execute::
from qiskit.visualization import plot_bloch_vector
%matplotlib inline
plot_bloch_vector([0,1,0], title="New Bloch Sphere")
.. jupyter-execute::
# You can use spherical coordinates instead of cartesian.
import numpy as np
plot_bloch_vector([1, np.pi/2, np.pi/3], coord_type='spherical')
"""
from qiskit.visualization.bloch import Bloch

Expand Down

0 comments on commit 316eaf5

Please sign in to comment.