Closed dimple12M closed 1 year ago
The second part of this issue (The size of the square of the elements are not equal for the imaginary plot) will be fixed by https://github.com/Qiskit/qiskit-terra/pull/8447.
I am investigating in the first part of the issue. The hinton plot currently plots the matrix transversely. I am not sure if this is the expected behavior.
from qiskit.quantum_info import DensityMatrix
from qiskit.tools.visualization import plot_state_hinton
state = DensityMatrix(
[
[1,1],
[-1,-0.5]
])
plot_state_hinton(state)
produces
The first part of the issue I think its related with the elements displayed on the hinton plot As seen from the density matrix, the elements of the real part is displayed as shown :
from qiskit import QuantumCircuit
from qiskit.quantum_info import DensityMatrix
from qiskit.visualization import plot_state_hinton
qc = QuantumCircuit(2)
qc.h(0)
state = DensityMatrix.from_instruction(qc)
print(state)
This the second example specific : elements related to real as well as imaginary section. I think, how are the elements are displaced is confusing . Still will look into it. Maybe we have can small description for the same.
from qiskit import QuantumCircuit
from qiskit.quantum_info import DensityMatrix
from qiskit.visualization import plot_state_hinton
![Screenshot 2022-08-10 at 4 10 46 PM](https://user-images.githubusercontent.com/65215560/183850058-45173b26-bbb1-4fa4-8186-e534dd6b726f.png)
state=DensityMatrix([[0.5+0.j, 0.+0.j, 0. -0.5j, 0. +0.j],
[0.5+0.j, 0.+0.j, 0. -0.5j, 0. +0.j],
[0.5 +0.j, 0. +0.j, 0. -0.5j, 0.+ 0.j],
[0.5 +0.j, 0. +0.j, 0. -0.5j, 0. +0.j]])
plot_state_hinton(state)
Environment
What is happening?
In the Visualization section: plot_hinton It displays 2 plots : one for real and one for imaginary There are 2 issues:
How can we reproduce the issue?
What should happen?
We expect the following plot_hinton
Any suggestions?
We make few simple changes in the state_visualizaton.py file and we can obtain the correct plot for the imaginary section in the plot_hinton.