From: Paul Ivanov <pivanov...@gmail.com>
To: Larry Evans <cppljev...@suddenlink.net>
Cc: 
Bcc: 
Subject: Re: [Matplotlib-users] what does numRows, numCols in subplot docs
 mean?
Reply-To: 
In-Reply-To: <4d32e05d.4090...@suddenlink.net>
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,
-- 
Paul Ivanov
314 address only used for lists,  off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 

Attachment: signature.asc
Description: Digital signature

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to