Skip to content

Disable legend on matplotlib.axes instance #2792

@gnsiva

Description

@gnsiva

Could we please have the functionality to disable the legend once its been instantiated?

e.g.

 f = plt.figure()
 ax = f.add_subplot(111)

 externalfunction(ax)

 # in the function ax.legend() has been called
 # would like to turn off the legend here

 plt.show()

From my StackOverflow question (http://stackoverflow.com/questions/21587318/matplotlib-cancel-legend-on-axes-object?noredirect=1#comment32612205_21587318) I have been advised to request this feature.

I also found the problem could be solved with the hack:

ax.get_legend().set_visible(False)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions