0.14.2- Qiskit Terra version:
3.7.6- Python version:
Windows 10 64 bit- Operating system:
I am trying to use qsphere function to display the states of the qubits in my quantum circuit but I am unable to display labels to indicate the state and angles of the qubit state. I am attaching the code below
from qiskit import *
from qiskit.tools.visualization import plot_state_qsphere
import numpy as np
%matplotlib inline
qr = QuantumRegister(3)
cr = ClassicalRegister(3)
qc = QuantumCircuit(qr, cr)
qc.ry(np.pi/2, 0)
qc.cx(0, 1)
backend = Aer.get_backend('statevector_simulator')
out = execute(qc,backend).result().get_statevector()
show_state_phases = True, use_degrees = True
plot_state_qsphere(out)
I was discussing this issue on the Slack channel. Initially i assumed that plot_state_qsphere() will display labels by default but someone suggested I use, _show_state_phases = True, use_degrees = True_ is show labels but adding this line did not make any difference. Could you please help me resolve this to display labels.
from qiskit import *
from qiskit.tools.visualization import plot_state_qsphere
import numpy as np
%matplotlib inline
qr = QuantumRegister(3)
cr = ClassicalRegister(3)
qc = QuantumCircuit(qr, cr)
qc.ry(np.pi/2, 0)
qc.cx(0, 1)
backend = Aer.get_backend('statevector_simulator')
out = execute(qc,backend).result().get_statevector()
plot_state_qsphere(out)
This program seems to give the correct result in my system
Hi @mtreinish, this issue could be solved by https://github.com/Qiskit/qiskit-terra/pull/4384
Has https://github.com/Qiskit/qiskit-terra/pull/4384 been made available in the latest qiskit version?
The PR did indeed fix that fix this on master already. It hasn't been included in a release yet since it was a new feature so wasn't backportable as a bugfix [1] in the recent 0.14.2 bugfix release. The next version of qiskit terra 0.15.0 will include that PR adding the new features for the qsphere plot.
Since, this has already been fixed on master I'm going to close this issue. But, if I'm missing something please feel free to reopen this.
[1] https://qiskit.org/documentation/contributing_to_qiskit.html#stable-branch-policy
Most helpful comment
The PR did indeed fix that fix this on master already. It hasn't been included in a release yet since it was a new feature so wasn't backportable as a bugfix [1] in the recent 0.14.2 bugfix release. The next version of qiskit terra 0.15.0 will include that PR adding the new features for the qsphere plot.
Since, this has already been fixed on master I'm going to close this issue. But, if I'm missing something please feel free to reopen this.
[1] https://qiskit.org/documentation/contributing_to_qiskit.html#stable-branch-policy