Qiskit-terra: plot_state_qsphere() function does not display labels

Created on 30 Jun 2020  路  3Comments  路  Source: Qiskit/qiskit-terra


Information

0.14.2- Qiskit Terra version:
3.7.6- Python version:
Windows 10 64 bit- Operating system:

What is the current behavior?

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

Steps to reproduce the problem

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)

What is the expected behavior?

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.

Suggested solutions

bug

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

All 3 comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nonhermitian picture nonhermitian  路  6Comments

cbjuan picture cbjuan  路  3Comments

ajavadia picture ajavadia  路  5Comments

derivation picture derivation  路  5Comments

Zhuravlev-A-E picture Zhuravlev-A-E  路  6Comments