TypeError: register_cmap() got an unexpected keyword argument 'data'

I am using fermipy to analyse an object in the sky.
When I try to plot the residual map by my own I get this output:

input:

fig = plt.figure(figsize=(14,6))
ROIPlotter(resid['sigma'],roi=gta.roi).plot(vmin=-5,vmax=5,levels=[-5,-3,3,5,7,9],subplot=121,cmap='RdBu_r')
plt.gca().set_title('Significance')
ROIPlotter(resid['excess'],roi=gta.roi).plot(vmin=-200,vmax=200,subplot=122,cmap='RdBu_r')
plt.gca().set_title('Excess Counts')
plt.savefig('PG_1553+113_resdid_map_complete.png')

output:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-8-2954d4ddbcc9> in <module>
      1 fig = plt.figure(figsize=(14,6))
----> 2 ROIPlotter(resid['sigma'],roi=gta.roi).plot(vmin=-5,vmax=5,levels=[-5,-3,3,5,7,9],subplot=121,cmap='RdBu_r')
      3 plt.gca().set_title('Significance')
      4 ROIPlotter(resid['excess'],roi=gta.roi).plot(vmin=-200,vmax=200,subplot=122,cmap='RdBu_r')
      5 plt.gca().set_title('Excess Counts')

~/anaconda3/envs/fermipy/lib/python3.7/site-packages/fermipy/plotting.py in plot(self, **kwargs)
    583         cb_kwargs = merge_dict(cb_kwargs, kwargs)
    584 
--> 585         im, ax = self._implot.plot(**im_kwargs)
    586 
    587         self._ax = ax

~/anaconda3/envs/fermipy/lib/python3.7/site-packages/fermipy/plotting.py in plot(self, subplot, cmap, **kwargs)
    293         ax = fig.add_subplot(subplot, projection=self._geom.wcs)
    294 
--> 295         load_ds9_cmap()
    296         try:
    297             colormap = plt.get_cmap(cmap)

~/anaconda3/envs/fermipy/lib/python3.7/site-packages/fermipy/plotting.py in load_ds9_cmap()
    144     }
    145 
--> 146     plt.register_cmap(name='ds9_b', data=ds9_b)
    147     plt.cm.ds9_b = plt.cm.get_cmap('ds9_b')
    148     return plt.cm.ds9_b

TypeError: register_cmap() got an unexpected keyword argument 'data'

My matplotlib version is 3.4.2

I think you would be far better off asking fermipy?

Passing data was deprecated in 3.3.
https://matplotlib.org/stable/api/prev_api_changes/api_changes_3.3.0.html#passing-raw-data-to-register-cmap

It appears that was removed a bit early in 3.4 without a note?

Looks like it’s already been reported to fermipy

Yes, looks like #15127. I guess we should start to test our deprecations to make sure they are not removed prematurely. Though it looks like data= was never tested in the first place…

Hi,

One thing that you can do that is replace data in 146 line of the plotting.py script by cmap.