From: Omer Khalid [mailto:omer.kha...@cern.ch] 
Sent: Wednesday, March 31, 2010 6:20 AM
To: Matplotlib Users
Subject: [Matplotlib-users] How to show separate legend for each subplot

Hi, 

I am wondering is there a way one could show a separate legend for each subplot 
in a figure? I would really really appreciate any ideas on this.
`~~~~~~~~~~~~~~~~~~~~~~~~~'

Omer,

Give this a shot:
# code --------->
import matplotlib.pyplot as pl
fig = pl.figure()
ax1 = fig.add_subplot(1,2,1)
ax2 = fig.add_subplot(1,2,2)

ax1.plot([1,2], [3,4], 'ko', label='First Axes')
ax2.plot([2,3], [4,5[, 'bs', label='Second Axes')

ax1.legend()
ax2.legend()
# <------------- code

There's also an example in the Examples section of the MPL website:
http://matplotlib.sourceforge.net/examples/pylab_examples/legend_demo3.html

Hope that helps,
-paul
------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to