[Matplotlib-users] deprecation of mpl_toolkits' colorbar implementation - substitute?

Eric Firing efiring at hawaii.edu
Fri Dec 3 01:53:04 EST 2021


Jon,

I think you can do one of three things: ignore the warning, set the 
rcParam to False, or update your mpl version to 3.4 or 3.5.  The second 
and third options might require small additional code changes.

https://github.com/matplotlib/matplotlib/commit/9a8ec761acea9b7f63cc2869712319f5d4a35920 
shows what was changed to start the deprecation.  Notice that there are 
only small changes to the axes_grid1/demo*.py examples in addition to 
adding the rcParam setting.

Eric

On 2021/12/02 1:01 PM, Slavin, Jonathan via Matplotlib-users wrote:
> Hi,
> 
> I'm wanting to do something like in the example "Demo Axes Grid", the 
> 2nd case where the grid has a single colorbar. That works the way I want 
> it, but I get a deprecation warning:
> 
> MatplotlibDeprecationWarning: Since 3.2, mpl_toolkits's own colorbar 
> implementation is deprecated; it will be removed two minor releases 
> later.  Set the 'mpl_toolkits.legacy_colorbar' rcParam to False to use 
> Matplotlib's default colorbar implementation and suppress this 
> deprecation warning.
> 
> So, I understand that that warning can be suppressed, but I'd rather 
> find a non-deprecated way of doing the same thing. So far I haven't 
> found it. The particular command that results in the warning is:
> grid.cbar_axes[0].colorbar(image)
> 
> I don't know of a way to add a colorbar to the grid of images the way I 
> want it. Any help would be appreciated.
> 
> Thanks,
> Jon
> -- 
> Jonathan D. Slavin
> Astrophysicist - High Energy Astrophysics Division
> Center for Astrophysics | Harvard & Smithsonian
> Office: (617) 496-7981 | Cell: (781) 363-0035
> 60 Garden Street | MS 83 | Cambridge, MA 02138
> 
> 
> 
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-users
> 



More information about the Matplotlib-users mailing list