Re: [R] Using subplot (from Hmisc) along with par(mfrow)

2014-07-06 Thread Frank Harrell
Greg I just re-copied the latest subplot and its help file from  
TeachingDemos to Hmisc for the next release.  Thanks for pointing this out.

Frank

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Using subplot (from Hmisc) along with par(mfrow)

2014-07-05 Thread Greg Snow
The subplot function in the TeachingDemos package is more up to date
than the version in Hmisc (the Hmisc version is a copy of an earlier
version of the one in TeachingDemos).  If you replace library(Hmisc)
with library(TeachingDemos) (with a recent version of TeachingDemos
installed) then the code works as you expect.

On Thu, Jul 3, 2014 at 1:45 PM, Cory Champagne cory.champ...@gmail.com wrote:

Hello all,
I think this should be a relatively easy solution involving par but I can't
figure it out, involving subplot:
I'm  making  a  three-figure plot, each with a subplot.  Here's simple
reproducible code below.  But each plot seems to call the original par
setting and redraws the new plot in the first position, rather than adding
subsequent plots in a single plot window.
Can someone tell me how to fix this so the result is three figures, each
containing a subplot, all within a single plot window?
Thanks,
-Cory
library(Hmisc)# subplot from the Hmisc package
par(mfrow=c(3,1) )# set mfrow for 3 rows and 1 column.
plot(1:10, 1:10, main = Plot 1)
subplot(plot(10,10, xlab=, ylab=), x=2, y=8, size = c(0.5, 0.5) )
plot(11:20, 11:20, main = Plot 2)
subplot(plot(10,10, xlab=, ylab=), x=12, y=18, size = c(0.5, 0.5)
)
plot(21:30, 21:30, main = Plot 3)
subplot(plot(10,10, xlab=, ylab=), x=22, y=28, size = c(0.5, 0.5)
)
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.



-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.com

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Using subplot (from Hmisc) along with par(mfrow)

2014-07-03 Thread Cory Champagne

   Hello all,
   I think this should be a relatively easy solution involving par but I can't
   figure it out, involving subplot:
   I'm  making  a  three-figure plot, each with a subplot.  Here's simple
   reproducible code below.  But each plot seems to call the original par
   setting and redraws the new plot in the first position, rather than adding
   subsequent plots in a single plot window.
   Can someone tell me how to fix this so the result is three figures, each
   containing a subplot, all within a single plot window?
   Thanks,
   -Cory
   library(Hmisc)# subplot from the Hmisc package
   par(mfrow=c(3,1) )# set mfrow for 3 rows and 1 column.
   plot(1:10, 1:10, main = Plot 1)
   subplot(plot(10,10, xlab=, ylab=), x=2, y=8, size = c(0.5, 0.5) )
   plot(11:20, 11:20, main = Plot 2)
   subplot(plot(10,10, xlab=, ylab=), x=12, y=18, size = c(0.5, 0.5)
   )
   plot(21:30, 21:30, main = Plot 3)
   subplot(plot(10,10, xlab=, ylab=), x=22, y=28, size = c(0.5, 0.5)
   )
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Using subplot (from Hmisc) along with par(mfrow)

2014-07-03 Thread David Winsemius

On Jul 3, 2014, at 12:45 PM, Cory Champagne wrote:

 
   Hello all,
   I think this should be a relatively easy solution involving par but I can't
   figure it out, involving subplot:
   I'm  making  a  three-figure plot, each with a subplot.  Here's simple
   reproducible code below.  But each plot seems to call the original par
   setting and redraws the new plot in the first position, rather than adding
   subsequent plots in a single plot window.
   Can someone tell me how to fix this so the result is three figures, each
   containing a subplot, all within a single plot window?
   Thanks,
   -Cory
   library(Hmisc)# subplot from the Hmisc package
   par(mfrow=c(3,1) )# set mfrow for 3 rows and 1 column.
   plot(1:10, 1:10, main = Plot 1)
   subplot(plot(10,10, xlab=, ylab=), x=2, y=8, size = c(0.5, 0.5) )
   plot(11:20, 11:20, main = Plot 2)
   subplot(plot(10,10, xlab=, ylab=), x=12, y=18, size = c(0.5, 0.5)
   )
   plot(21:30, 21:30, main = Plot 3)
   subplot(plot(10,10, xlab=, ylab=), x=22, y=28, size = c(0.5, 0.5)
   )

Need to read a bit further down below the 'mfrow' and 'mfcol' arguments in par, 
specifically until you get to 'mfg':

library(Hmisc)
  par(mfrow=c(3,1) )
  plot(1:10, 1:10, main = Plot 1)
  subplot(plot(10,10, xlab=, ylab=), x=2, y=8, size = c(0.5, 0.5) )
  par(mfg=c(2,1) ); plot(11:20, 11:20, main = Plot 2)
  subplot(plot(10,10, xlab=, ylab=), x=12, y=18, size = c(0.5, 0.5)
  )
  par(mfg=c(3,1)); plot(21:30, 21:30, main = Plot 3)
  subplot(plot(10,10, xlab=, ylab=), x=22, y=28, size = c(0.5, 0.5)
  )

I suspect that the subplot manipulations of par settings are the cause of the 
problem. It is restoring the mfg pointer.

-- 
David Winsemius
Alameda, CA, USA

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.