Re: [R] Lattice device page options-margins

2005-03-10 Thread Paul Murrell
Hi
Bock, Michael wrote:
 


-Original Message-
From: Deepayan Sarkar [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 09, 2005 5:09 PM
To: r-help@stat.math.ethz.ch
Cc: Paul Murrell; Bock, Michael; Sundar Dorai-Raj
Subject: Re: [R] Lattice device page options-margins

On Wednesday 09 March 2005 13:54, Paul Murrell wrote:
Hi
Sundar Dorai-Raj wrote:
Bock, Michael wrote on 3/9/2005 1:19 PM:
I am using lattice to make figures as pdfs:
trellis.device(device = pdf,file = Figure6.pdf,color = FALSE)
I need to specify some blank space on the left-hand margins (the 
pages will be bound so we need about 0.5 inch)). I have tried a 
number of solutions but none seems to work (e.g. 

par.set). Can this 

be done when initiating the plotting device? Or is the 

some other 

way that does not require me to manually move everything over?
Michael,
I believe you can do this using print.trellis and setting the 
position argument. E.g.

trellis.device(device = pdf,file = Figure6.pdf,color 

= FALSE) xy 

- xyplot(...) print(xy, pos = c(0.10, 0, 1, 1))
dev.off()
Or if you want exactly 0.5 inches, something like ...
# may need
# library(grid)
trellis.device(device = pdf,file = Figure6.pdf,color = 
FALSE) xy 

- xyplot(1:10 ~ 1:10) pushViewport(viewport(x=1,
  width=unit(1, npc) - unit(0.5, inches),
  just=right))
# to show region you're plotting in
# grid.rect(gp=gpar(col=grey))
print(xy, newpage=FALSE)
popViewport()
dev.off()
Yet another option, especially if you want this for multiple 
plots without having to handle each one separately, is to say 
(after loading
lattice):

lattice.options(layout.widths = list(left.padding = 
   list(x = 0.5, units = inches)))

Unlike par settings though, this would stay in effect across devices.
Deepayan

Thanks for the suggestions. None of these do exactly what I want. I have
some multi panel plotts
Excepted Commands:
BC.PP-bwplot(PP.PAH ~ Area, Crab, horizontal = FALSE,
ylab = Priority Pollutant PAHs (mg/kg),
scales = list(x=free,rot=90),  aspect = 1.5,
main = list(label = Blue Crabs,cex=0.8,font=1),
fontfamily = HersheySans)
RM.PP-bwplot( PP.PAH ~ Area, Mussel, horizontal = FALSE,
ylab = ,
scales = list(x=free,rot=90), aspect = 1.5,
main = list(label=   Ribbed Mussels,cex =0.8,font=1),
fontfamily = HersheySans)
print(BC.PP, split = c(1,1,2,1), more = TRUE )
print(RM.PP, split = c(2,1,2,1),more = TRUE )
grid.text(label = Figure 6. Priority Pollutant PAH Tissue
Concentrations,
  x = unit(0.01, npc), y = unit(0.1, npc),
  just = left, rot = 0,
  check.overlap = FALSE, default.units = npc,
  name = NULL, gp = gpar(fontsize = 10, font = 2), draw = TRUE)
grid.text(label = Privileged and Confidential \nAttorney Work Product,
  x = unit(0.01, npc), y = unit(0.95, npc),
  just = left, rot = 0,
  check.overlap = FALSE, default.units = npc,
  name = NULL, gp = gpar(fontsize = 6, font = 3), draw = TRUE)
All of the suggestions shrink the individual boxplots so they both now
have empty space on the left size. I guess what I really want is to be
able define the plotting area as a portion of the page, allowing for a
blank region on the left. Basically defining the margin of the print
area.
BSomething like:
trellis.device(device = pdf,file = Figure6.pdf,color = FALSE,left =
0.1, right = 0.9)
Assuming the hypothetical left and right commands set the print area for
the pdf. Hopefully this better defines my ideal solution.
Thanks for the suggestions, if an ideal solution can not be found I at
least have enough to develop a work around.  It just too bad I hadn't
though of this issue before writing so many scripts to make my plots
that will now have to be adjusted manually.

Do you mean like this ...?
# Dummy data
# (it would be easier to give an answer if you gave us the real thing)
Crab - data.frame(PP.PAH=rnorm(20),
   Area=factor(sample(20, 1:2, replace=TRUE)))
Mussel - data.frame(PP.PAH=rnorm(20),
 Area=factor(sample(20, 1:2, replace=TRUE)))
BC.PP-bwplot(PP.PAH ~ Area, Crab, horizontal = FALSE,
ylab = Priority Pollutant PAHs (mg/kg),
scales = list(x=free,rot=90),  aspect = 1.5,
main = list(label = Blue Crabs,cex=0.8,font=1),
fontfamily = HersheySans)
RM.PP-bwplot( PP.PAH ~ Area, Mussel, horizontal = FALSE,
ylab = ,
scales = list(x=free,rot=90), aspect = 1.5,
main = list(label=   Ribbed Mussels,cex =0.8,font=1),
fontfamily = HersheySans)
trellis.device(device = pdf,file = Figure6.pdf,color = FALSE)
# push viewport for ALL drawing
pushViewport(viewport(x=.1, width=.8, just=left))
# just to show region you're plotting in
grid.rect(gp=gpar(col=grey))
print(BC.PP, split = c(1,1,2,1), more = TRUE, newpage=FALSE)
print(RM.PP, split = c(2,1,2,1),more = TRUE)
grid.text(label = Figure 6. Priority Pollutant PAH Tissue Concentrations

RE: [R] Lattice device page options-margins

2005-03-10 Thread Bock, Michael
 

 -Original Message-
 From: Deepayan Sarkar [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, March 09, 2005 5:09 PM
 To: r-help@stat.math.ethz.ch
 Cc: Paul Murrell; Bock, Michael; Sundar Dorai-Raj
 Subject: Re: [R] Lattice device page options-margins
 
 On Wednesday 09 March 2005 13:54, Paul Murrell wrote:
  Hi
 
  Sundar Dorai-Raj wrote:
   Bock, Michael wrote on 3/9/2005 1:19 PM:
   I am using lattice to make figures as pdfs:
   trellis.device(device = pdf,file = Figure6.pdf,color = FALSE)
  
   I need to specify some blank space on the left-hand margins (the 
   pages will be bound so we need about 0.5 inch)). I have tried a 
   number of solutions but none seems to work (e.g. 
 par.set). Can this 
   be done when initiating the plotting device? Or is the 
 some other 
   way that does not require me to manually move everything over?
  
   Michael,
  
   I believe you can do this using print.trellis and setting the 
   position argument. E.g.
  
   trellis.device(device = pdf,file = Figure6.pdf,color 
 = FALSE) xy 
   - xyplot(...) print(xy, pos = c(0.10, 0, 1, 1))
   dev.off()
 
  Or if you want exactly 0.5 inches, something like ...
 
  # may need
  # library(grid)
  trellis.device(device = pdf,file = Figure6.pdf,color = 
 FALSE) xy 
  - xyplot(1:10 ~ 1:10) pushViewport(viewport(x=1,
 width=unit(1, npc) - unit(0.5, inches),
 just=right))
  # to show region you're plotting in
  # grid.rect(gp=gpar(col=grey))
  print(xy, newpage=FALSE)
  popViewport()
  dev.off()
 
 Yet another option, especially if you want this for multiple 
 plots without having to handle each one separately, is to say 
 (after loading
 lattice):
 
 lattice.options(layout.widths = list(left.padding = 
 list(x = 0.5, units = inches)))
 
 Unlike par settings though, this would stay in effect across devices.
 
 Deepayan
 
 
Thanks for the suggestions. None of these do exactly what I want. I have
some multi panel plotts
Excepted Commands:
BC.PP-bwplot(PP.PAH ~ Area, Crab, horizontal = FALSE,
ylab = Priority Pollutant PAHs (mg/kg),
scales = list(x=free,rot=90),  aspect = 1.5,
main = list(label = Blue Crabs,cex=0.8,font=1),
fontfamily = HersheySans)
RM.PP-bwplot( PP.PAH ~ Area, Mussel, horizontal = FALSE,
ylab = ,
scales = list(x=free,rot=90), aspect = 1.5,
main = list(label=   Ribbed Mussels,cex =0.8,font=1),
fontfamily = HersheySans)
print(BC.PP, split = c(1,1,2,1), more = TRUE )
print(RM.PP, split = c(2,1,2,1),more = TRUE )
grid.text(label = Figure 6. Priority Pollutant PAH Tissue
Concentrations,
  x = unit(0.01, npc), y = unit(0.1, npc),
  just = left, rot = 0,
  check.overlap = FALSE, default.units = npc,
  name = NULL, gp = gpar(fontsize = 10, font = 2), draw = TRUE)
grid.text(label = Privileged and Confidential \nAttorney Work Product,
  x = unit(0.01, npc), y = unit(0.95, npc),
  just = left, rot = 0,
  check.overlap = FALSE, default.units = npc,
  name = NULL, gp = gpar(fontsize = 6, font = 3), draw = TRUE)


All of the suggestions shrink the individual boxplots so they both now
have empty space on the left size. I guess what I really want is to be
able define the plotting area as a portion of the page, allowing for a
blank region on the left. Basically defining the margin of the print
area.

BSomething like:
trellis.device(device = pdf,file = Figure6.pdf,color = FALSE,left =
0.1, right = 0.9)
Assuming the hypothetical left and right commands set the print area for
the pdf. Hopefully this better defines my ideal solution.

Thanks for the suggestions, if an ideal solution can not be found I at
least have enough to develop a work around.  It just too bad I hadn't
though of this issue before writing so many scripts to make my plots
that will now have to be adjusted manually.

Mike

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Lattice device page options-margins

2005-03-10 Thread Chuck Cleland
You can add some space to the left by setting the left.padding component 
of the layout.widths trellis setting. For example:

library(lattice)
trellis.device(new=TRUE)
trellis.par.set(layout.widths = list(left.padding = 20))
require(stats)
## Tonga Trench Earthquakes
Depth - equal.count(quakes$depth, number=8, overlap=.1)
xyplot(lat ~ long | Depth, data = quakes)
hope this helps,
Chuck Cleland
Bock, Michael wrote:
I am using lattice to make figures as pdfs:
trellis.device(device = pdf,file = Figure6.pdf,color = FALSE)
I need to specify some blank space on the left-hand margins (the pages
will be bound so we need about 0.5 inch)). I have tried a number of
solutions but none seems to work (e.g. par.set). Can this be done when
initiating the plotting device? Or is the some other way that does not
require me to manually move everything over?

Michael J. Bock, PhD.
ARCADIS
24 Preble St. Suite 100
Portland, ME 04101
207.828.0046
fax 207.828.0062

[[alternative HTML version deleted]]
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 452-1424 (M, W, F)
fax: (917) 438-0894
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Lattice device page options-margins

2005-03-09 Thread Bock, Michael
I am using lattice to make figures as pdfs:
trellis.device(device = pdf,file = Figure6.pdf,color = FALSE)

I need to specify some blank space on the left-hand margins (the pages
will be bound so we need about 0.5 inch)). I have tried a number of
solutions but none seems to work (e.g. par.set). Can this be done when
initiating the plotting device? Or is the some other way that does not
require me to manually move everything over?




Michael J. Bock, PhD.
ARCADIS
24 Preble St. Suite 100
Portland, ME 04101
207.828.0046
fax 207.828.0062




[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Lattice device page options-margins

2005-03-09 Thread Sundar Dorai-Raj

Bock, Michael wrote on 3/9/2005 1:19 PM:
I am using lattice to make figures as pdfs:
trellis.device(device = pdf,file = Figure6.pdf,color = FALSE)
I need to specify some blank space on the left-hand margins (the pages
will be bound so we need about 0.5 inch)). I have tried a number of
solutions but none seems to work (e.g. par.set). Can this be done when
initiating the plotting device? Or is the some other way that does not
require me to manually move everything over?


Michael,
I believe you can do this using print.trellis and setting the position 
argument. E.g.

trellis.device(device = pdf,file = Figure6.pdf,color = FALSE)
xy - xyplot(...)
print(xy, pos = c(0.10, 0, 1, 1))
dev.off()
--sundar
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Lattice device page options-margins

2005-03-09 Thread Paul Murrell
Hi
Sundar Dorai-Raj wrote:

Bock, Michael wrote on 3/9/2005 1:19 PM:
I am using lattice to make figures as pdfs:
trellis.device(device = pdf,file = Figure6.pdf,color = FALSE)
I need to specify some blank space on the left-hand margins (the pages
will be bound so we need about 0.5 inch)). I have tried a number of
solutions but none seems to work (e.g. par.set). Can this be done when
initiating the plotting device? Or is the some other way that does not
require me to manually move everything over?


Michael,
I believe you can do this using print.trellis and setting the position 
argument. E.g.

trellis.device(device = pdf,file = Figure6.pdf,color = FALSE)
xy - xyplot(...)
print(xy, pos = c(0.10, 0, 1, 1))
dev.off()

Or if you want exactly 0.5 inches, something like ...
# may need
# library(grid)
trellis.device(device = pdf,file = Figure6.pdf,color = FALSE)
xy - xyplot(1:10 ~ 1:10)
pushViewport(viewport(x=1,
  width=unit(1, npc) - unit(0.5, inches),
  just=right))
# to show region you're plotting in
# grid.rect(gp=gpar(col=grey))
print(xy, newpage=FALSE)
popViewport()
dev.off()
Paul
--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
[EMAIL PROTECTED]
http://www.stat.auckland.ac.nz/~paul/
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Lattice device page options-margins

2005-03-09 Thread Deepayan Sarkar
On Wednesday 09 March 2005 13:54, Paul Murrell wrote:
 Hi

 Sundar Dorai-Raj wrote:
  Bock, Michael wrote on 3/9/2005 1:19 PM:
  I am using lattice to make figures as pdfs:
  trellis.device(device = pdf,file = Figure6.pdf,color = FALSE)
 
  I need to specify some blank space on the left-hand margins (the
  pages will be bound so we need about 0.5 inch)). I have tried a
  number of solutions but none seems to work (e.g. par.set). Can
  this be done when initiating the plotting device? Or is the some
  other way that does not require me to manually move everything
  over?
 
  Michael,
 
  I believe you can do this using print.trellis and setting the
  position argument. E.g.
 
  trellis.device(device = pdf,file = Figure6.pdf,color = FALSE)
  xy - xyplot(...)
  print(xy, pos = c(0.10, 0, 1, 1))
  dev.off()

 Or if you want exactly 0.5 inches, something like ...

 # may need
 # library(grid)
 trellis.device(device = pdf,file = Figure6.pdf,color = FALSE)
 xy - xyplot(1:10 ~ 1:10)
 pushViewport(viewport(x=1,
width=unit(1, npc) - unit(0.5, inches),
just=right))
 # to show region you're plotting in
 # grid.rect(gp=gpar(col=grey))
 print(xy, newpage=FALSE)
 popViewport()
 dev.off()

Yet another option, especially if you want this for multiple plots 
without having to handle each one separately, is to say (after loading 
lattice):

lattice.options(layout.widths = list(left.padding = 
list(x = 0.5, units = inches)))

Unlike par settings though, this would stay in effect across devices.

Deepayan

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html