Customizing colorbar border color on matplotlib

后端 未结 2 1878
逝去的感伤
逝去的感伤 2021-02-20 12:10

how can I change the colorbar borders so that they are white and not black (externals border and between each segment)?

For example:

x=randint(100, size=         


        
相关标签:
2条回答
  • 2021-02-20 13:12

    As PiQuer mentioned:

    cb.outline.set_edgecolor('white')
    

    works nowadays

    0 讨论(0)
  • 2021-02-20 13:17

    edit: Notice the comments below for MPL 1.3 and later.

    Add:

    cb=colorbar(cs, drawedges=True)
    
    cb.outline.set_color('white')
    cb.outline.set_linewidth(2)
    
    cb.dividers.set_color('white')
    cb.dividers.set_linewidth(2)
    
    0 讨论(0)
提交回复
热议问题