Wednesday, May 6, 2009

Note: matlpotlib - A problem of using legend

http://www.scipy.org/Cookbook/Matplotlib/Legend

legend cannot use before you plot data in figure.
You have to plot, bar, or use any figure command to put data into the target figure object.
And then use legend to label your data.

How to Locate the legend label?
Assign a vaule to "loc=". There are three kinds of assignment.
  1. location string: 'best' or 'upper right'
  2. location code: 0, 1, 2...
  3. (x, y) = x is the percentage from bottom, y is the percentage from left.
For example,
’best’ : 0, (only implemented for axis legends)
’upper right’ : 1,
’upper left’ : 2,
’lower left’ : 3,
’lower right’ : 4,
’right’ : 5,
’center left’ : 6,
’center right’ : 7,
’lower center’ : 8,
’upper center’ : 9,
’center’ : 10,

No comments:

Clicky

Clicky Web Analytics