Skip to content
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/ISSUE] Matplotlib function set_clim will be deprecated in Matplotlib 3.3 #24

Closed
lizziel opened this issue Sep 5, 2019 · 1 comment
Assignees
Labels
category: Bug Something isn't working

Comments

@lizziel
Copy link
Contributor

lizziel commented Sep 5, 2019

Using the benchmark plotting functions with the currently recommended package configuration gives the following warning about a Matplotlib function that will be deprecated in a future version:

The set_clim function was deprecated in Matplotlib 3.1 and will be removed in 3.3. Use ScalarMappable.set_clim instead. [benchmark.py:1714]

This is not a problem right now but could become a problem in the future when Matplotlib is updated. We should switch to the recommended function before Matplotlib releases 3.3.

@yantosca yantosca self-assigned this Sep 6, 2019
yantosca added a commit that referenced this issue Sep 6, 2019
This commit addresses GCPy issue #24:
   #24

which says that the set_clim function will be deprecated in a future
version of matplotlib.

The matplotlib documentation about API changes
    https://matplotlib.org/3.1.0/api/api_changes.html

says this:
   "matplotlib.colorbar.ColorbarBase is no longer a subclass of
    cm.ScalarMappable. This inheritance lead to a confusing situation
    where the cm.ScalarMappable passed to matplotlib.colorbar.Colorbar
    (colorbar) had a set_norm method, as did the colorbar. The
    colorbar is now purely a follower to the ScalarMappable norm
    and colormap, and the old inherited methods set_norm,
    set_cmap, set_clim are deprecated, as are the getter versions
    of those calls. To set the norm associated with a colorbar
    do colorbar.mappable.set_norm() etc."

Therefore, we now use cb.mappable.set_norm(norm) to manually pass
the norm object (which renders the data range into the range of
0..1 for plotting) to the colorbar.  This produces the same effect
as before.

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
@yantosca
Copy link
Contributor

yantosca commented Sep 6, 2019

This issue should now be resolved by commit b3a8311. We now use

cb.mappable.set_norm(norm)

to explicitly pass the norm object (which translates the data range from to 0..1 for the matplotlib functions) to the colorbar.

@yantosca yantosca closed this as completed Sep 6, 2019
@yantosca yantosca added category: Bug Something isn't working resolved labels Oct 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants