Tables for matplotlib

Hi John,

I’ve moved on a fair bit with this, still quite a way to go.

I’m attaching some new files and patches which will make it easier for me to explain where i am at with all this. is my hacked version of that does tables.

axes.patch is a patch to that adds table support. and are a couple of demos of what I’ve got so far. shows tables being places all over the place. shows the sort of thing I’m really after.

The basic idea with table is that it allows you to create a table which can be placed either inside the axes (as per legend), or outside the axes. This is controlled by the loc arguement.

Each cell in a table can have an optional handle as per legend and some text.

Currently you have to specify the column widths for the table. Really two cases should be supported: allow the user to specify the widths (this is needed so you can line up tables with bar plots) and allow the Table to auto-adjust the widths to make everything just big enough for whatever text is present (this is handy for legend type stuff). I’ve done nothing for auto-guessing of widths as yet.

I’ve made the grid within the tables an option + I think with a little more work could just use to do what it has to do.

There is an ugly hack, rowOffset that I use in to get the row labels to align with the appropriate data. My idea was that it might be simpler to have a basic table object and then build up more complicated stuff such as including row-labels by creating multiple tables.

Currently I can’t decide whether i wouldn’t be better trying to support the row/column labels all in the one object – I suspect this is the way to go since it is easier to get things to line up this way rather than trying to align lots of separate tables (eg if i start supporting different fonts for different tables then we’ll really be in trouble).

Now as I said there is still lots to do here.

There are all sorts of minor and not so minor alignment issues to address – a lot of these I think I can solve by paying a bit more attention to the code.

The most significant problem at the moment is that the tables are getting clipped – I’m not sure how I control the size of the border around the axes.

I’d also like to make it so you can specify that text should be left/right/centre aligned.

There is also quite a bit of work to do on the actual interface to the table objects, basically making them smart about the parameters they are given so that simple cases just work by magic. They are in danger of sprouting a plethora of options + no-one will be able to figure out how to use the things.

Anyway, so far it has been fun working with this stuff.

John (11.3 KB)

axes.patch (586 Bytes) (1.24 KB) (1.37 KB)