From: Paul N. <pn...@ui...> - 2008-01-03 16:11:41
|
Hello, I have further investigated problems with legend() when numpoints = 1. The images show what happens when numpoints = 1 for a Line2D, such as when calling plot(), for a LineCollection, and for a RegularPolyCollection, such as when using scatter(). As can be seen in the figures, calling legend() with numpoints = 1 results in either an absence of a line or a misplacement of a symbol or colored region, creating an ugly legend. I have made the three figures using the script included below, line_collection.py from the examples, and scatter_demo.py from the examples. I will send a second message that includes a patch that attempts to fix the problems with legend() when numpoints=1, and some figures showing the improvement in the legends. Paul --- #!/usr/bin/env python import matplotlib matplotlib.use('GTKAgg') from pylab import * x = arange(0.0, 5.0) y = 2.0 * x figure(1) plot(x, y, 'o', label='symbol') plot(x, y, 'k-', label='line') leg=legend(loc='best',numpoints=1) show() |