Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Cannot create custom colorbar with SymLogNorm #16269

Closed
@dstansby

Description

@dstansby

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:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp