-
Notifications
You must be signed in to change notification settings - Fork 902
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
ENH: mapclassify plot legend as discrete colorbar #2239
base: main
Are you sure you want to change the base?
Conversation
I personally like this change but I think it needs a wider discussion as it is essentially a breaking change. I think that in future, we should default to colorbar but I am not sure that we should do that abruptly, so maybe some transitional period would be helpful. And I think that we should make sure that colorbar is not larger than the plot itself. |
I totally agree with @TLouf's suggestion. In many research paper, when different areas are distinguished by various colors, they are usually discrete colorbar, in order to highlight the difference because of continuous colorbar are not easy to read specific values. In other cases it may be to show the overall trend between regions, in this case a continuous colorbar is usually used. Overall, I wonder if it's possible to have this feature as an optional parameter to plot instead of suddenly being the default colorbar. |
c4aa001
to
6493abc
Compare
I agree with the optional parameter, I restored the historical behaviour and set it as default. A colorbar can be generated by passing
Personally I don't think so, this would imply using |
I am recently working on the discrete colorbar in my research program but I am no expert in the underlying implementation and combination of geopandas with matplotlib. I also find that the gridded maps with the same or different colorbar(s) are widely used in many papers. Will the geopandas offer options for flexible colorbar creation (e.g. the single colorbar for all subplots and one colorbar for each subplot) in the future? I came up with a workaround script by using the "UserDefined" scheme with self-defined colorbar, but it may not be applicable for general cases. P.S. I am a fan of geopandas and would like to hear about update on this functionality. |
fixes #2154
This entails a change in the
fmt
keyword to format tick labels, as colorbars' tick labels have been formatted with old-style formats (like"%.3f"
), until the very recent matplotlib/matplotlib/pull/21542. By the way I wonder if it is desirable to keep "%.2f" as default formatting, or to rather not provide one.I left a TODO about adding a legend entry for geometries with missing data, which I think would be easier to implement in #2012 once this one is in.
Example output: