I will always have at minimum 2 sub-plots which should be positioned on top of each other without the graph areas touching. They should be wider than they are tall.
Then if a certain condition is met (in this case if there is a specific type of peak in the data) I would like this peak plotted on it's own sub-plot on the right of the other two plots. This third plot should be taller than it is wide. There could be any number of these extra plots including none. I already have the positions I would like to plot between I just don't know how to make add_subplot do what I want.
The first two plots are working perfectly, and I would have thought the one in the loop would add an nth subplot that is 1 wide and 2 tall, but I get the error: IndexError: index out of range.
The code below is simply trying to get things the right shape (I know I'm not plotting any data yet).
fig = pl.figure()
ax1 = fig.add_subplot(2, 1, 1)
ax2 = fig.add_subplot(2, 1, 2)
n = 2
#if there is a peak plot it on this subplot
peak = fig.add_subplot(1, 2, n)
n =+ 1
ncan only be either 1 or 2 , as you specified 2by1 subplot grid.