-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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 ax kwarg to matplotlib visualization functions #3053
Conversation
Given that matplotlib calls the module |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that the parameters are not optional. Previously working code is breaking :
psi = [0.70710678118654746, 0, 0, 0.70710678118654746]
plot_state_hinton(psi)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-3-7e1883ce9c63> in <module>
1 psi = [0.70710678118654746, 0, 0, 0.70710678118654746]
----> 2 plot_state_hinton(psi)
~/repos/qiskit-terra/qiskit/visualization/state_visualization.py in plot_state_hinton(rho, title, figsize, ax_real, ax_imag)
99 fig = ax_real.get_figure()
100 else:
--> 101 fig = ax_imag.get_figure()
102 ax1 = ax_real
103 ax2 = ax_imag
AttributeError: 'NoneType' object has no attribute 'get_figure'
It's not obvious for me how this new options are used. Maybe a more explicit subplot example in the release notes?
8e2b98d
to
6a5e31b
Compare
It was a typo in |
do you have any thoughts about #3053 (comment) ? |
Sorry I missed that among the other review comments earlier. I really don't care about the name much, |
Okey. That's a good argument to keep it. Let's merge. |
3661377
to
1fb5ec5
Compare
@1ucian0 I manually rebased the branch locally to correct the broken merge that was accidentally pushed removing the pylint disable. You should double check that I didn't mess something up in that process because there were a lot of changes in that rebase stack and I might have messed up one of the conflict fixes. |
This commit adds support for passing a matplotlib axes to visualization functions. This enables integrating the qiskit visualizations into a larger matplotlib visualization. When an ax kwarg is set that input will be used for the output visualization and a new figure will not be generated or returned. Fixes Qiskit#1950
This commit adds support for passing a matplotlib axes to visualization functions. This enables integrating the qiskit visualizations into a larger matplotlib visualization. When an ax kwarg is set that input will be used for the output visualization and a new figure will not be generated or returned. Fixes Qiskit#1950
9b79bb7
to
5566611
Compare
As part of rebasing and cleaning up the branch from several failed merge attempts a few lines from plot_state_city() were lost. This commit fixes that mistake and restores the z axis labels which were missing from the imaginary component subplot.
This reverts commit 5566611.
* Add ax kwarg to matplotlib visualization functions This commit adds support for passing a matplotlib axes to visualization functions. This enables integrating the qiskit visualizations into a larger matplotlib visualization. When an ax kwarg is set that input will be used for the output visualization and a new figure will not be generated or returned. Fixes Qiskit#1950 * typo in release note * Add ax kwarg to matplotlib visualization functions This commit adds support for passing a matplotlib axes to visualization functions. This enables integrating the qiskit visualizations into a larger matplotlib visualization. When an ax kwarg is set that input will be used for the output visualization and a new figure will not be generated or returned. Fixes Qiskit#1950 * Fix lint and typos * pylint: disable=invalid-name * Fix lost lines from rebase As part of rebasing and cleaning up the branch from several failed merge attempts a few lines from plot_state_city() were lost. This commit fixes that mistake and restores the z axis labels which were missing from the imaginary component subplot. * Fix rebase typo * Revert "pylint: disable=invalid-name" This reverts commit 5566611.
Summary
This commit adds support for passing a matplotlib axes to visualization
functions. This enables integrating the qiskit visualizations into a
larger matplotlib visualization. When an ax kwarg is set that input will
be used for the output visualization and a new figure will not be
generated or returned.
Details and comments
Fixes #1950