Cc:

Bcc:

mean?

Reply-To:

In-Reply-To: <4D32E05D.4090808@...2108...>

X-PGP-Key: http://pirsquared.org/PaulIvanov0F3E28F7.asc

Larry Evans, on 2011-01-16 06:11, wrote:

subplot(numRows, numCols, plotNum)

New subplots that overlap old will delete the old axes.

However, that doc does not explain what a row or column is or what

overlap means.

Is there some way the figure is partitioned into rows and columns and the

subplots appear in these rows and columns. If so, then how is this

partition

done? Does subplot(1,2,1) appear to the left and at same level as

subplot(1,2,2)?

What if there's subplot(1,2,1) and subplot(2,1,1). Do they overlap and

if so, why?

IOW, what's the definition of overlap?

Hi Larry,

Overlap means identical parameters for subplot:

In [1]: ax1 = plt.subplot(1,2,1)

In [2]: ax2 = plt.subplot(1,2,2)

In [3]: ax3 = plt.subplot(1,2,1) # overlap, will delete ax1

In [4]: fig = plt.gcf()

In [5]: fig.axes

Out[5]:

[<matplotlib.axes.AxesSubplot object at 0xa1b582c>,

<matplotlib.axes.AxesSubplot object at 0xa33968c>]

In [6]: ax1

Out[6]: <matplotlib.axes.AxesSubplot object at 0xa1b582c>

In [7]: ax2

Out[7]: <matplotlib.axes.AxesSubplot object at 0xa33968c>

In [8]: ax3

Out[8]: <matplotlib.axes.AxesSubplot object at 0xa1b582c>

In [9]: ax4 = plt.subplot(2,2,1) # also overlaps with ax3

In [10]: ax5 = plt.subplot(2,2,4) # overlaps with ax2

In [12]: fig.axes

Out[12]:

[<matplotlib.axes.AxesSubplot object at 0xa49882c>,

<matplotlib.axes.AxesSubplot object at 0xa5118ac>]

The last parameter ("plotNum") for subplot determines which row

and column you want based on something like the formula:

row = plotNum // numCols

column = plotNum % numCols

Hope that helps,

## ···

From: Paul Ivanov <pivanov314@...287...>

To: Larry Evans <cppljevans@...2108...>

Subject: Re: [Matplotlib-users] what does numRows, numCols in subplot docs

--

Paul Ivanov

314 address only used for lists, off-list direct email at:

http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7