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

Add hinton diagram to plot_state methods #1246

Merged
merged 12 commits into from
Nov 13, 2018

Conversation

mtreinish
Copy link
Member

Summary

The interactive js plot_state visualizations had an additional method
'hinton' for drawing a hinton diagram of the quantum state. However
this method was missing from the non-js plot_state function. This commit
adds the missing method.

Details and comments

The hinton diagram implementation here is based
on the example from the matplotlib documentation, which can be found
here: https://matplotlib.org/gallery/specialty_plots/hinton_demo.html

The interactive js plot_state visualizations had an additional method
'hinton' for drawing a hinton diagram of the quantum state. However
this method was missing from the non-js plot_state function. This commit
adds the missing method. THe hinton diagram implementation here is based
on the example from the matplotlib documentation, which can be found
here: https://matplotlib.org/gallery/specialty_plots/hinton_demo.html
@jaygambetta
Copy link
Member

can you post a version of the figure

@mtreinish
Copy link
Member Author

mtreinish commented Nov 9, 2018

@jaygambetta this is what it does now:

hinton

Basically just a 2d version of the cities plot:

city

I still need to look into adding the x and y ticks and labels.

Personally I don't find this super useful, especially compared to the 3d bar plot, but I only pushed the PR because the iplot_state function (for the js version) supports this method and it was missing from the local version. (as part of #1229 )

@jaygambetta
Copy link
Member

jaygambetta commented Nov 9, 2018

great. I agree and it looks good but i will not use it.
I will fix the Pauli but first, i'm dealing with a pip mess and found out the readme is broken a bit so I fix that first.

@nonhermitian
Copy link
Contributor

You need a colorbar as well to make it useful:

http://qutip.org/docs/latest/images/visualization-rho-ss.png

@mtreinish
Copy link
Member Author

mtreinish commented Nov 9, 2018

@nonhermitian oh, actually this implementation doesn't do color shading. It's binary colors, black (negative) or white (positive) and only the size is adjusted for the value. I didn't check qutip and just referred to the matplotlib docs which did it that way.

@jaygambetta
Copy link
Member

yeah there is no color bar its the size of the square

@mtreinish
Copy link
Member Author

Ok, now with tick marks and labels the same script generates:

hinton

@jaygambetta
Copy link
Member

does it have to be one above the other. Can they go next to each other

@mtreinish
Copy link
Member Author

@jaygambetta sure, I'll put them side by side. I just did top to bottom because I copied the subplot setup from the 3d bar graph function.

@mtreinish
Copy link
Member Author

hinton

@jaygambetta
Copy link
Member

jaygambetta commented Nov 12, 2018

Great. I think we should change the city as well to be side by side

@jaygambetta
Copy link
Member

also I think we should change the order of the city labels to match this

@mtreinish
Copy link
Member Author

@jaygambetta sure, can you open an issue for the improvements to the city plots (just so I don't forget about it)

@nonhermitian nonhermitian mentioned this pull request Nov 12, 2018
5 tasks
@mtreinish mtreinish added this to the 0.7 milestone Nov 13, 2018
@jaygambetta jaygambetta merged commit e79549f into Qiskit:master Nov 13, 2018
@mtreinish mtreinish deleted the add-hinton branch November 13, 2018 17:14
lia-approves pushed a commit to edasgupta/qiskit-terra that referenced this pull request Jul 30, 2019
* Add hinton diagram to plot_state methods

The interactive js plot_state visualizations had an additional method
'hinton' for drawing a hinton diagram of the quantum state. However
this method was missing from the non-js plot_state function. This commit
adds the missing method. THe hinton diagram implementation here is based
on the example from the matplotlib documentation, which can be found
here: https://matplotlib.org/gallery/specialty_plots/hinton_demo.html

* Add imaginary component subplot

* Add tick marks and labels

* Put plots next to each other
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants