Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to scale matplotlib subplot heights individually

Using matplotlib/pylab....

How do I plot 5 heatmaps as subplots which have the same number of columns but different row counts? In other words, I need each subplot's height to be scaled differently.

Perhaps an image better illustrates the problem...

alt text http://img98.imageshack.us/img98/5853/heatmap.png

I need the data points to all be square, AND the columns to be lined up, so the heights have to change according to how many rows each subplot has.

I've tried:

  1. The scaling options mentioned here. The above plot is with axis('tight').
  2. The y-axis scaling solutions mentioned here.

... but no luck so far.

like image 863
pufferfish Avatar asked Aug 04 '09 15:08

pufferfish


2 Answers

I haven't tried this for any of my own work, but perhaps the matplotlib AxesGrid toolkit might be what you are looking for.

like image 198
Tim Whitcomb Avatar answered Sep 30 '22 14:09

Tim Whitcomb


Don't use subplot but axes to create your subplots - the latter allows arbitrary positioning of the subplot.

like image 37
Jouni K. Seppänen Avatar answered Sep 30 '22 13:09

Jouni K. Seppänen