#!/usr/bin/env python from pylab import * import os N=100 props = dict( alpha=0.5, faceted=False ) handles = [] colours = ['red', 'green', 'blue', 'magenta', 'cyan', 'yellow'] colours = ['red', 'green', 'blue'] for colour in colours: x, y = rand(2,N) s = 400.0 * rand(N) handles.append(scatter(x, y, c=colour, s=s, **props)) legend(handles, colours) grid(True) leg = gca().get_legend() ltext = leg.get_texts() # all the text.Text instance in the legend llines = leg.get_lines() # all the lines.Line2D instance in the legend frame = leg.get_frame() # the patch.Rectangle instance surrounding the legend # see text.Text, lines.Line2D, and patches.Rectangle for more info on # the settable properties of lines, text, and rectangles frame.set_facecolor('0.80') # set the frame face color to light gray setp(ltext, fontsize='small') # the legend text fontsize setp(llines, linewidth=1.5) # the legend linewidth #leg.draw_frame(False) # don't draw the legend frame #show() savefig('legend_scatter.png') os.system('ls *.png') os.system('scp -r *.png haines@pitot.marine.unc.edu:/afs/isis.unc.edu/depts/marine/workspace/haines/public_html/nccoos/test')