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
[Bug]: Error in Hexbin plot in Matplotlib 3.0 onward #27383
Comments
This was actually incorrect prior to version 3.5: https://matplotlib.org/3.5.3/api/prev_api_changes/api_changes_3.5.0.html#hexbin-with-a-log-norm We had been adding 1 so every bin had a value, but 0 cannot be displayed on a logarithmically scaled colormap, so now it has no value (and thus are not displayed if zero). We no longer incorrectly add 1. There was some changes during the early 3.8 series to the boundary conditions of hexbin, but default behavior should be what it used to be as of 3.8.2 (and more consistent with different modes of calling hexbin overall). |
Hi,
I understand the problem with zero in the log scale.
My concern is with the color bar labeling and scaling. The hexbin plot in
matplotbin2.2.5 looks okay. The hexbin says log scale means values are
taken log10(var), not the log10(var) with log scaling of colorbar, which is
present in matplotlib 3.0 onward version.
*Example:* See the left plot where the color bar displays bin count. Let's
say the bin count is 500, then log10(500) = 2.69, which is expected to be
shown in the colorbar (see plots for hexbin plot for matplotlib 2.2.5).
Unfortunately, in the latex version of matplotlib, the value and colorbar
are different.
Please clarify it for me. And do the necessary update.
Best wishes,
Zubair Shaikh
----------------------------------------------------------
*Dr. Zubair Ibrahim Shaikh,*
*Postdoctoral Researcher,Space Sciences Laboratory (SSL),*
*University of California**, Berkeley,*
*7 Gauss Way, CA 94720, USA*
*email:* ***@***.*** ***@***.***>u*
*website: **https://sites.google.com/view/shaikhzubair/
<https://sites.google.com/view/shaikhzubair/>*
*Orcid: https://orcid.org/0000-0002-9206-632
<https://orcid.org/0000-0002-9206-6327>7*
-------------------------------------------------------------------------
…On Mon, Nov 27, 2023 at 5:08 PM Kyle Sunden ***@***.***> wrote:
This was actually incorrect prior to version 3.5:
https://matplotlib.org/3.5.3/api/prev_api_changes/api_changes_3.5.0.html#hexbin-with-a-log-norm
We had been adding 1 so every bin had a value, but 0 cannot be displayed
on a logarithmically scaled colormap, so now it has no value (and thus are
not displayed if zero). We no longer incorrectly add 1.
There was some changes during the early 3.8 series to the boundary
conditions of hexbin, but default behavior should be what it used to be as
of 3.8.2 (and more consistent with different modes of calling hexbin
overall).
—
Reply to this email directly, view it on GitHub
<#27383 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AP57Y7LRJSNCT4UBVUNSG7LYGU2R5AVCNFSM6AAAAAA74XVJYCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRYHEYDAMBTHA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I agree that the label on the colorbar should be updated. At some point we went from having to "manually" do the log scale to the color mapping / normalization machinery doing it for us. |
Thank you for understanding the problem.
I hope you will update it soon.
Best wishes,
Zubair Shaikh
----------------------------------------------------------
*Dr. Zubair Ibrahim Shaikh,*
*Postdoctoral Researcher,Space Sciences Laboratory (SSL),*
*University of California**, Berkeley,*
*7 Gauss Way, CA 94720, USA*
*email:* ***@***.*** ***@***.***>u*
*website: **https://sites.google.com/view/shaikhzubair/
<https://sites.google.com/view/shaikhzubair/>*
*Orcid: https://orcid.org/0000-0002-9206-632
<https://orcid.org/0000-0002-9206-6327>7*
-------------------------------------------------------------------------
…On Mon, Dec 4, 2023 at 9:15 AM Thomas A Caswell ***@***.***> wrote:
I agree that the label on the colorbar should be updated.
At some point we went from having to "manually" do the log scale to the
color mapping / normalization machinery doing it for us.
—
Reply to this email directly, view it on GitHub
<#27383 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AP57Y7K5Q2227K23ZOZO73LYHYAM5AVCNFSM6AAAAAA74XVJYCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZZGEYDOOJSGY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Good first issue - notes for new contributorsThis issue is suited to new contributors because it does not require understanding of the Matplotlib internals. To get started, please see our contributing guide. We do not assign issues. Check the Development section in the sidebar for linked pull requests (PRs). If there are none, feel free to start working on it. If there is an open PR, please collaborate on the work by reviewing it rather than duplicating it in a competing PR. If something is unclear, please reach out on any of our communication channels. |
The relevant change here was #9223, I believe. |
Bug summary
First, I would like to thank you for creating a wonderful matplotlib for data visualization.
I am writing to inform you about problems in hexbin plot in the Matplotlib 3.0 onward. When I was working on my data analysis, I noticed something was wrong when we plotted the distribution of the bin in the log scale. Moreover, the hexbin plot is correct in the previous version of the matplotlib 2.2.5.
I've attached the files of the same. You can clearly observe that the main error is when we plot the bins in log scale. I hope you will look into the problem and update it accordingly.
Code for reproduction
Actual outcome
NA
Expected outcome
NA
Additional information
No response
Operating system
Windows
Matplotlib Version
3.8.2
Matplotlib Backend
No response
Python version
python 3
Jupyter version
No response
Installation
conda
The text was updated successfully, but these errors were encountered: