Japanese
言語
English
Bengali
French
German
Japanese
Korean
Portuguese
Spanish
Tamil

qiskit.quantum_info.Statevector.draw

Statevector.draw(output=None, **drawer_args)[ソース]

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().

パラメータ
  • 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.

戻り値

matplotlib.Figure or str or TextMatrix or IPython.display.Latex: Drawing of the Statevector.

例外

ValueError – when an invalid output method is selected.

サンプル

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')

(Source code, png, hires.png, pdf)

../_images/qiskit-quantum_info-Statevector-draw-1.png