[R] Lattice: how to reduce/shrink plot area
baptiste auguie
ba208 at exeter.ac.uk
Thu Sep 25 10:25:11 CEST 2008
Hi,
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,
library(grid)
library(lattice)
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)))
print(p, newpage=F)
upViewport()
grid.text("some text elsewhere", x=0.8, gp = gpar(col = rgb(43/255,
140/255, 190/255)))
HTH,
baptiste
On 25 Sep 2008, at 06:23, K. Elo wrote:
> Hi,
>
> 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!
>
> Regards,
> Kimmo
>
> ______________________________________________
> R-help at 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.
_____________________________
Baptiste Auguié
School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK
Phone: +44 1392 264187
http://newton.ex.ac.uk/research/emag
More information about the R-help
mailing list