Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plot_state_qsphere() function does not display labels #4634

Closed
Sridhar-Majety-UCD opened this issue Jun 30, 2020 · 3 comments
Closed

plot_state_qsphere() function does not display labels #4634

Sridhar-Majety-UCD opened this issue Jun 30, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@Sridhar-Majety-UCD
Copy link

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

@Sridhar-Majety-UCD Sridhar-Majety-UCD added the bug Something isn't working label Jun 30, 2020
@rochisha0
Copy link
Contributor

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

@arunraja-hub
Copy link
Contributor

Hi @mtreinish, this issue could be solved by #4384
Has #4384 been made available in the latest qiskit version?

@mtreinish
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants