pufferfish
pufferfish

Reputation: 17415

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.

Upvotes: 5

Views: 5404

Answers (2)

Jouni K. Seppänen
Jouni K. Seppänen

Reputation: 44118

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

Upvotes: 2

Tim Whitcomb
Tim Whitcomb

Reputation: 10677

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

Upvotes: 4

Related Questions