On Monday 14 February 2005 18:12, Jeff Jorgensen wrote:
> Dear R-sters,
>
> I was wondering if anyone has encountered the following issues.  I've
> figured out how to get multiple levelplots [library(lattice)] on a
> single plot.  However, when I add text (adding axis labels for the
> entire four panel plot) the text is missing when I insert the *.eps
> file I've created into my LaTeX document (via MikTeX-WinEdt).  And,
> I've just upgraded to R v2.0.1 from v1.8.1 (Windows), and each
> individual levelplot is smaller compared to the older R release.
>
> Any clues as to 1) how I can recover the lost text, and 

Your use is incorrect, in the sense that the return value of 
grid.locator() is not a valid input of ltext. You could do the 
following to fix this, 

library(grid)
ltext(lapply(grid.locator(), convertX, "native", TRUE),
      lab="x-axis label, where I click",cex=1.5)
ltext(lapply(grid.locator(), convertX, "native", TRUE),
      lab = "y-axis label, where I click",
      cex=1.5, srt=90)

but that doesn't seem to help either. So, there seems to be a bug 
somewhere. However, you presumably want something like 


grid.text(x = .05, y = .5, lab="y-axis label", 
          default.units = "npc", gp = gpar(cex=1.5), 
          rot = 90)
grid.text(x = .5, y = .05, lab="x-axis label", 
          default.units = "npc", gp = gpar(cex=1.5))

for the last two steps, which seems to work. 


> 2) increase the size of each of the levelplots?

You need to change the following settings, in particular the entries 
that end with 'padding' (similarly for 'layout.heights').

> str(trellis.par.get("layout.widths"))
List of 13
 $ left.padding     : num 1
 $ key.left         : num 1
 $ key.ylab.padding : num 1
 $ ylab             : num 1
 $ ylab.axis.padding: num 1
 $ axis.left        : num 1
 $ axis.panel       : num 1
 $ panel            : num 1
 $ between          : num 1
 $ axis.right       : num 1
 $ axis.key.padding : num 1
 $ key.right        : num 1
 $ right.padding    : num 1

Deepayan

>
> Cheers,
>
> Jeff Jorgensen
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Sample code that illustrates what I'm trying to do:
>
> #create a levelplot
> x<-seq(pi/4, 5*pi, length = 100)
> y<-seq(pi/4, 5*pi, length = 100)
> r<-as.vector(sqrt(outer(x^2, y^2, "+")))
> grid<-expand.grid(x=x, y=y)
> grid$z<-cos(r^2) * exp(-r/(pi^3))
> a<-levelplot(z~x*y, grid, cuts = 50, xlab="", ylab=",
>   colorkey = FALSE)
>
> #create the multiple panel plot, here using all the same levelplot
> trellis.par.set(list(background=list(col="white"))) #white background
> #using position to scale the plots up and to the right ~10%
> #to make room for the axis labels
> print(a,position=c(0.1,0.1,1,1),split=c(1,1,2,2),more=T)
> print(a,position=c(0.1,0.1,1,1),split=c(1,2,2,2),more=T)
> print(a,position=c(0.1,0.1,1,1),split=c(2,1,2,2),more=T)
> print(a,position=c(0.1,0.1,1,1),split=c(2,2,2,2),more=F)
> #commands that let you click where you want the labels centered
> ltext(grid::grid.locator(),lab="x-axis label, where I click",cex=1.5)
> ltext(grid::grid.locator(),lab="y-axis label, where I
> click",cex=1.5,srt=90) #save device to an *.eps file, to be called
> later by a \includegraphics command
> dev.copy2eps(file="twobytwoplot.eps")

______________________________________________
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

Reply via email to