While I don't known much about how table class in matplotlib works internally, I think it would not be easy (because the legend is quite a unique object whose position is determined at drawing time).
The current legend implementation is based on the offsetbox module. While it does not have a table-like class, you can emulate something similar. The link below show my attempt to do this, but it turned out that the code is rather complicated. Take a look and see if you can adopt it for your needs. I may try to implement some table-like class with offsetbox in the future, to make things more easy. http://abitofpythonabitofastronomy.blogspot.com/2010/01/customized-legend.html Regards, -JJ On Mon, Jan 18, 2010 at 4:46 PM, ashleyd <ashleydanger...@gmail.com> wrote: > > I'm trying to figure out if it's possible to use a table as a legend of > sorts, as I have a very busy graph I'm trying to describe. > > Basically: > - I'm visualizing data from a series of similar but not-quite-identical > simulations > - I'd like to have the simulation parameters displayed in a table format, > with an example line from the graph next to each row > > So, I might have rows that look like: > "Line", "Alpha", "Beta"... > "-----" , "0.125", "2.0".... > "- - -", "0.120", "2.0".... > > The problem is I can't figure out how to include a line "sample" like what's > included with the legend in a table, and I can't figure out how to make > legend entries that don't have any lines. I suspect that I could make a > dummy white plot, and use that for my data entries in a legend and make a > legend-table hybrid that way. However, I think using a table would be > cleaner and look nicer. > > Does anyone have any ideas as to how to get this working? > > While I'm posting, another quick question -- my text output looks really > shoddy, even at high DPIs. It looks like somebody took a screenshot of a > tiny font and scaled it up with a linear filter. I have freetype installed, > and the matplotlib build script outputs the following, if it's helpful: > > BUILDING MATPLOTLIB > matplotlib: 0.99.1.1 > python: 2.5.4 (r254:67916, Apr 4 2009, 17:56:17) [GCC > 4.3.3] > platform: linux2 > > REQUIRED DEPENDENCIES > numpy: 1.2.1 > freetype2: 9.20.3 > > OPTIONAL BACKEND DEPENDENCIES > libpng: 1.2.27 > Tkinter: Tkinter: 67737, Tk: 8.5, Tcl: 8.5 > wxPython: 2.8.9.1 > * WxAgg extension not required for wxPython >= 2.8 > Gtk+: gtk+: 2.16.1, glib: 2.20.1, pygtk: 2.14.1, > pygobject: 2.16.1 > Mac OS X native: no > Qt: no > Qt4: no > Cairo: 1.4.12 > > OPTIONAL DATE/TIMEZONE DEPENDENCIES > datetime: present, version unknown > dateutil: 1.4.1 > pytz: 2008h > > OPTIONAL USETEX DEPENDENCIES > dvipng: 1.11 > ghostscript: 8.64 > latex: 3.141592 > pdftops: 0.10.5 > > Thank you in advance for any advice! > > -Ashley > -- > View this message in context: > http://old.nabble.com/Using-a-table-as-a-legend%2C-ugly-text-output--tp27206248p27206248.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > Throughout its 18-year history, RSA Conference consistently attracts the > world's best and brightest in the field, creating opportunities for Conference > attendees to learn about information security's most important issues through > interactions with peers, luminaries and emerging and established companies. > http://p.sf.net/sfu/rsaconf-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > ------------------------------------------------------------------------------ Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-dev2dev _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users