Japanese
言語
English
Japanese
German
Korean
Portuguese, Brazilian
French
Shortcuts

qiskit.visualization.plot_state_paulivec

plot_state_paulivec(state, title='', figsize=None, color=None, ax=None, *, rho=None)[ソース]

Plot the paulivec representation of a quantum state.

Plot a bargraph of the mixed state rho over the pauli matrices

パラメータ
  • state (Statevector or DensityMatrix or ndarray) – an N-qubit quantum state.

  • title (str) – a string that represents the plot title

  • figsize (tuple) – Figure size in inches.

  • color (list or str) – Color of the expectation value bars.

  • ax (matplotlib.axes.Axes) – An optional Axes object to be used for the visualization output. If none is specified a new matplotlib Figure will be created and used. Additionally, if specified there will be no returned Figure since it is redundant.

戻り値

The matplotlib.Figure of the visualization if the ax kwarg is not set

戻り値の型

matplotlib.Figure

例外
  • ImportError – Requires matplotlib.

  • VisualizationError – if input is not a valid N-qubit state.

サンプル

from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector
from qiskit.visualization import plot_state_paulivec
%matplotlib inline

qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)

state = Statevector.from_instruction(qc)
plot_state_paulivec(state, color='midnightblue',
     title="New PauliVec plot")
../_images/qiskit.visualization.plot_state_paulivec_0_0.png ../_images/qiskit.visualization.plot_state_paulivec_0_1.png