[R] Lattice: how to reduce/shrink plot area
ba208 at exeter.ac.uk
Thu Sep 25 10:25:11 CEST 2008
I'm not sure I understand your example, it'd be easier with some
reproducible code. I think you'd better off using grid, in particular
the figure 5.22 from the book R Graphics provides an example of
embedding a lattice graph in a page. Here's a simplified version,
df <- data.frame(x=rnorm(100), y=rnorm(100))
p <- xyplot(y~x, data=df)
pushViewport(viewport(x=0.3, width = 0.5, height = 0.8, angle = 0,
name = "topvp"))
grid.rect(gp = gpar(col = rgb(43/255, 140/255, 190/255)))
grid.text("some text elsewhere", x=0.8, gp = gpar(col = rgb(43/255,
On 25 Sep 2008, at 06:23, K. Elo wrote:
> is there a command or parameter for reducing the plotting area with
> lattice? What I am looking for is an option similar to 'mai' or 'mar'
> from the graphs package.
> Background: I have plotted several charts with horizontal stacked bars
> and now I would like to add info about percentages of each "sub bar"
> beneath the plot (with mtext (?) ). So the plot should look something
> like this:
> | AAABBBBBBCCCCD | 30 35 20 15
> | |
> | AAAAAAABBCCDDD | 50 15 15 20
> | |
> | AABBBBBBBBBBCD | 15 65 10 10
> Or is there a better way for achieving what I am looking for?
> Thanks in advance for Your help!
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
School of Physics
University of Exeter
EX4 4QL, UK
Phone: +44 1392 264187
More information about the R-help