qiskit.quantum_info.Statevector.draw¶
- Statevector.draw(output=None, **drawer_args)[source]¶
Return a visualization of the Statevector.
repr: ASCII TextMatrix of the state's
__repr__
.text: ASCII TextMatrix that can be printed in the console.
latex: An IPython Latex object for displaying in Jupyter Notebooks.
latex_source: Raw, uncompiled ASCII source to generate array using LaTeX.
qsphere: Matplotlib figure, rendering of statevector using plot_state_qsphere().
hinton: Matplotlib figure, rendering of statevector using plot_state_hinton().
bloch: Matplotlib figure, rendering of statevector using plot_bloch_multivector().
city: Matplotlib figure, rendering of statevector using plot_state_city().
paulivec: Matplotlib figure, rendering of statevector using plot_state_paulivec().
- Parameters
output (str) -- Select the output method to use for drawing the state. Valid choices are repr, text, latex, latex_source, qsphere, hinton, bloch, city, or paulivec. Default is repr. Default can be changed by adding the line
state_drawer = <default>
to~/.qiskit/settings.conf
under[default]
.drawer_args -- Arguments to be passed directly to the relevant drawing function or constructor (TextMatrix(), array_to_latex(), plot_state_qsphere(), plot_state_hinton() or plot_bloch_multivector()). See the relevant function under qiskit.visualization for that function's documentation.
- Returns
matplotlib.Figure
orstr
orTextMatrix
orIPython.display.Latex
: Drawing of the Statevector.- Raises
ValueError -- when an invalid output method is selected.
Examples
Plot one of the Bell states
from numpy import sqrt from qiskit.quantum_info import Statevector sv=Statevector([1/sqrt(2), 0, 0, -1/sqrt(2)]) sv.draw(output='hinton')