Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Closed
Labels
Milestone
Description
Bug report
Bug summary
Creating a colorbar with aSymLogNorm
fails, using thefig.colorbar(cm.ScalarMappable(norm=norm, cmap=cmap), ax=ax)
example given in the docs.
Code for reproduction
importmatplotlib.pyplotaspltimportmatplotlib.colorsasmcolorimportmatplotlib.cmascmnorm=mcolor.SymLogNorm(5)fig,ax=plt.subplots()fig.colorbar(cm.ScalarMappable(norm=norm,cmap='viridis'),cax=ax)
Actual outcome
Traceback (mostrecentcalllast):File"test.py",line8,in<module>fig.colorbar(cm.ScalarMappable(norm=norm,cmap='viridis'),cax=ax)File"/Users/dstansby/github/matplotlib/lib/matplotlib/figure.py",line2201,incolorbarcb=cbar.colorbar_factory(cax,mappable,**cb_kw)File"/Users/dstansby/github/matplotlib/lib/matplotlib/colorbar.py",line1686,incolorbar_factorycb=Colorbar(cax,mappable,**kwargs)File"/Users/dstansby/github/matplotlib/lib/matplotlib/colorbar.py",line1210,in__init__ColorbarBase.__init__(self,ax,**kwargs)File"/Users/dstansby/github/matplotlib/lib/matplotlib/colorbar.py",line472,in__init__self.draw_all()File"/Users/dstansby/github/matplotlib/lib/matplotlib/colorbar.py",line495,indraw_allself._process_values()File"/Users/dstansby/github/matplotlib/lib/matplotlib/colorbar.py",line945,in_process_valuesb=self.norm.inverse(self._uniform_y(self.cmap.N+1))File"/Users/dstansby/github/matplotlib/lib/matplotlib/colors.py",line1276,ininverseval=val* (self._upper-self._lower)+self._lowerAttributeError:'SymLogNorm'objecthasnoattribute'_upper'
Expected outcome
No error
Matplotlib version
- Operating system: macOS 10.15.2
- Matplotlib version: '3.2.0rc2.post1221+g20805b805'
- Matplotlib backend (
print(matplotlib.get_backend())
): Qt5Agg - Python version: 3.7
- Jupyter version (if applicable):
- Other libraries: