Skip to content

colorbar label prints "None" when label=None #14563

Closed
@Owainn

Description

@Owainn

Bug report

Bug summary

When giving the variable None to the label argument of matplotlib.pyplot.colorbar(), i.e label=None, the label still appears, with the text "None", as if being given label="None".

Code for reproduction

import numpy as np 
import matplotlib.pyplot as plt 

fig, ax = plt.subplots() 
img = ax.imshow(np.random.random((10,10))) 
fig.colorbar(mappable=img, ax=ax, label=None)   
fig.show()

Actual outcome

colormap_label

Expected outcome

The label should not appear. The bug is still present in matplotlib 3.1.

Matplotlib version

  • Operating system: Ubuntu 18.04.2 LTS x86_64
  • Matplotlib version: 2.2.3
  • Matplotlib backend (print(matplotlib.get_backend())): Qt5Agg
  • Python version: 3.7.2
  • Jupyter version (if applicable):
  • Other libraries:

I installed matplotlib via conda through the default channel.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions