-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Passing clim as keyword argument to pcolormesh does not change limits. #10346
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
Comments
Do the docs say that you can pass I think having a |
@jklymak They don't list The docs I'm referring to are: https://matplotlib.org/api/_as_gen/matplotlib.axes.Axes.pcolormesh.html |
Yep you are right. Thats actually pretty annoying. Not sure what should change. It should be possible to not override |
This is long-ago cleverness coming back to bite us. The clim kwarg is being inherited based on the |
Do you think a note in the docstring that the |
The docstring is autogenerated from pieces pulled from various places, and used in many places. Maybe it would make sense to add a note to the set_clim docstring to the effect that it should not be used when vmin, vmax are available. I suspect this clash between clim and vmin, vmax is widespread, and there are probably many other such inherited properties that it would be better not to expose as kwargs. I haven't thought it through, though. |
fwiw I would just pass everything to QuadMesh and teach ScalarMappable how to handle them.
or, if we decide that's not the route we want to take, we should just deprecate clim, instead of keeping it half-assed... Note that the above solution will apply kwargs in the order they are given, so 1) that only works on Py3.6+ which keeps kwargs order (by mpl3 is coming :)) and 2) requires the user to pass the norm before the clims, which does not seem unreasonable... We also have a precedent of just forcing the order of the kwargs to something logically consistent in https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/text.py#L178. |
You can do that. But you need to decide what takes precedence - vmin/vmax or clim. That’s pretty bad API if there are two ways to do the same thing with arbitrary precedence. I’d prefer to deprecate clim. Reopening because the documentation change is fine but not really the root of the problem. |
I think this was effectively fixed by #21146. Feel free to reopen if not. |
Bug report
Bug summary
Not sure if this is really a bug or just a user issue. I expected that passing a
clim
tuple topcolormesh
with novmin
orvmax
specified would update the color scale limits. I found that I had to usevmin
andvmax
instead. Maybe I am misunderstanding andvmin
andvmax
should always be used. However, it looks like the kwargs are passed into theQuadMesh
constructor and thenclim
is overwritten withvmin
andvmax
, even in they are None andclim
is given. (https://github.com/heath730/matplotlib/blob/master/lib/matplotlib/axes/_axes.py#L5629).Code for reproduction
Matplotlib version
print(matplotlib.get_backend())
): TkAggWould something like:
Before the vmin and vmax pops on this line be a reasonable update?
The text was updated successfully, but these errors were encountered: