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
Update plot_wigner_sphere and delete matrix_histogram_complex #2193
Update plot_wigner_sphere and delete matrix_histogram_complex #2193
Conversation
Codeclimte detects the same code in matrix_histogram and matrix_histogram_complex, but matrix_histogram_complex will be deleted after matrix_histogram takes over it and the problem will be solved |
sample plot of matrix_histogram |
I moved |
@Ericgig Hi. Do you have any advice on plot_wigner_sphere and matrix_histogram? I will fix the documentation error tomorrow. |
@Ericgig Hi. I tried to fix the documentation error, but I do not know how to fix the following errors. Could you help me?
|
qutip/visualization.py
Outdated
- If set to ``"scaled"`` (default), each color is chosen by | ||
passing the absolute value of the corresponding matrix | ||
element into `cmap` with the sign of the real part. | ||
passing the absolute value of the corresponding matrix | ||
element into `cmap` with the sign of the real part. | ||
- If set to ``"threshold"``, each square is plotted as | ||
the maximum of `cmap` for the positive real part and as | ||
the minimum for the negative part of the matrix element; | ||
note that this generalizes `"threshold"` to complex numbers. | ||
the maximum of `cmap` for the positive real part and as | ||
the minimum for the negative part of the matrix element; | ||
note that this generalizes `"threshold"` to complex numbers. | ||
- If set to ``"phase"``, each color is chosen according to | ||
the angle of the corresponding matrix element. | ||
the angle of the corresponding matrix element. |
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.
I think it's these bullet list that cause the issues with the documentation.
The indentation is needed.
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.
Thanks! This solved the problem. The other two are in matrix_histogram.
@Ericgig This PR is. also ready for review. The build doc fails, but it is not related to my change. |
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.
A few issues to fix, but overall looks nice.
@@ -679,12 +720,10 @@ def matrix_histogram(M, xlabels=None, ylabels=None, title=None, limits=None, | |||
""" | |||
|
|||
# default options | |||
default_opts = {'figsize': None, 'cmap': 'jet', 'cmap_min': 0., | |||
'cmap_max': 1., 'zticks': None, 'bars_spacing': 0.2, | |||
default_opts = {'zticks': None, 'bars_spacing': 0.2, |
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.
Could you rename this variable, it is used later with values no longer the default.
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.
I changed the code to use options
argument instead of default_opts and changed the default value from None
to {}
.
@Ericgig Hi. I fixed the issues you suggested. |
|
||
'threshold': float, optional | ||
Threshold for when bars of smaller height should be transparent. If | ||
not set, all bars are colored according to the color map. |
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.
not set, all bars are colored according to the color map. | |
not set, all bars are colored according to the color map. | |
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.
One last small change.
@Ericgig I added an indent. The doc looks good now. |
Checklist
Thank you for contributing to QuTiP! Please make sure you have finished the following tasks before opening the PR.
You can use pycodestyle to check your code automatically
doc
folder, and the notebook. Feel free to ask if you are not sure.doc/changes/<PR number>.<type>
'type' can be one of the following: feature, bugfix, doc, removal, misc, or deprecation (see here for more information).Do the same change for plot_wigner_sphere and matrix_histogram as #2170 did.
#2170