[R] Settings of lattice graphs

Paul Murrell p.murrell at auckland.ac.nz
Thu Nov 7 00:47:53 CET 2002


Hi


hgoehlmann at gmx.de wrote:
> 
> Thanks for the replies already. Still, with all your help I have not been
> able to get what I wanted. Ok, I should be a little more detailed.
> 
> (1) I would like to create a function which draws a levelplot with a
> colorkey at the bottom to a vectorized file (win.metafile)
> (2) this function will receive data from a matrix that can vary in number of
> rows and will visualize the data in the matrix - I am trying to use
> levelplot because I get a nice colorkey with it - unlike image
> (3) the colorkey should have a fixed height at the bottom (say 40 pixels)
> (4) as the number of rows increases or decreases the size of the graphic
> should change accordingly
> 
> BUT...   the colorkey dimensions should be fixed (in terms of height of the
> colorkey = the 40 pixels) and the height of the rows in the levelplot should
> be fixed as well. And this is where the problem starts...   I can define the
> canvas size according to nrow(matrix) + x (for the colorkey) and even split
> the canvas into two sections (using viewport), but since the levelplot always
> draws a margin around itself (even though I am setting scales=list(draw=F) ),
> the height of the rows in the levelplot varies with the number of rows I am
> feeding into levelplot...


Does the aspect argument provide what you want?  For example, ...

library(lattice)

# 10 rows 
x <- matrix(rnorm(100), ncol=10)
lp1 <- levelplot(x, colorkey=list(space="bottom"),
                 aspect=10/10)
print(lp1)

# 5 rows -- each row taller than in previous plot
x <- matrix(rnorm(50), ncol=5)
lp2 <- levelplot(x, colorkey=list(space="bottom"),
                 aspect=5/10)
print(lp2)

Paul
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list