plot(x, y, '-r') plot(x[::20], y[::20], 'ro') from matplotlib.lines import Line2D line = Line2D(range(10), range(10), linestyle='-', marker='o') legend((line,), (label,)) line = plot(x, y, '-r') markers = plot(x[::20], y[::20], 'ro') lgd = legend([line], ['data'], numpoints=3) lgd.get_lines()[0].set_marker('o') draw() figure() axes([0.1,0.1,0.71,0.8]) plot([0,1],[0,1],label="line 1") hold(1) plot([0,1],[1,0.5],label="line 2") legend(loc=(1.03,0.2)) show() ax = gca() ax.legend_ = None draw() def remove_legend(ax=None): """Remove legend for ax or the current axes.""" from pylab import gca, draw if ax is None: ax = gca() ax.legend_ = None draw() x = range(10) y = range(10) handles = plot(x, y) legend(handles, ["label1"], prop={"size":12})