matplotlib cancel legend on axes object

Anake

I am using an external module which automatically adds a legend to the plot. I would like to know if there is a way of turning off the legend, something like ax.set_legend(False).

I could fix it by hacking the module but I would rather not do that.

example:

 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()

Update:

I have raised a github issue for this https://github.com/matplotlib/matplotlib/issues/2792

Alvaro Fuentes

You need to change the visibility of your legend, try this: ax.legend().set_visible(False)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

What exactly is a matplotlib axes object?

From Dev

matplotlib 2.0 changing axes fontsize and legend fontsize independently

From Dev

Getting data from matplotlib axes object

From Dev

Setting active subplot using axes object in matplotlib?

From Dev

How to get the limits of plotted data from a Figure or Axes object in Matplotlib?

From Dev

Legend in matplotlib

From Dev

matplotlib legend shows "Container object of 10 artists" instead of label

From Dev

Figure and axes methods in matplotlib

From Dev

Matplotlib pyplot axes formatter

From Dev

On matplotlib logarithmic axes labels

From Dev

How should I pass a matplotlib object through a function; as Axis, Axes or Figure?

From Dev

How to determine the projection (2D or 3D) of a matplotlib axes object?

From Dev

How should I pass a matplotlib object through a function; as Axis, Axes or Figure?

From Dev

Matplotlib scatter plot with legend

From Dev

Matplotlib legend for an arrow

From Dev

Matplotlib legend fontsize

From Dev

tabular legend layout for matplotlib

From Dev

Matplotlib Stackplot legend Error

From Java

Matplotlib scatter plot legend

From Dev

Duplicate items in legend in matplotlib?

From Dev

Shade legend line in matplotlib

From Dev

matplotlib legend background color

From Dev

legend alignment in matplotlib

From Dev

Multiple titles in legend in matplotlib

From Dev

Align legend rows in matplotlib

From Dev

Customizing legend in matplotlib

From Dev

Get Matplotlib legend location?

From Dev

Matplotlib editing legend labels

From Dev

Getting the width of a legend in matplotlib