I would like to remove the frame around the legend window. I have found several ways. However, none of them implements them using the "axis method".
The code below gets the result, but I want to know a cleaner, more elegant way, perhaps like ax.legend.draw_frame(False) or something like that. Any ideas if such a method exists without using pylab?
SOLUTION: use ax.legend(numpoints=1, loc=3, frameon=False) as suggested by Evert
import numpy as np import matplotlib.pyplot as plt from pylab import legend x = np.linspace(1,10, 100) y = x**3 fig = plt.figure() ax = fig.add_subplot(1,1,1) ax.plot(x,y, 'bo', label='Blah!') lg = legend(numpoints = 1, loc=2) lg.get_frame().set_alpha(0)
Rohit source share