Displaying 6 results from an estimated 6 matches for "placegrob".
2005 Apr 14
2
Legend in xyplot two columns
Dear R-Help
I have some trouble to set the legend in a xyplot into two rows.
The code below gives me the legend in the layout I am looking for, I
just rather have it in two rows.
library(lattice)
schluessel <- list(
points=list( col="red", pch=19, cex=0.5 ),
text=list(lab="John"),
lines=list(col="blue"),
2009 Sep 19
1
matrix operations on grobs and grid units
...id.layout(nrow, ncol, just=just,
widths = widths,
heights = heights) )
label.ind <- 1 # index running for the vector of labels
for (ii in seq(1, ncol, 1)) {
for (jj in seq(1, nrow, 1)) {
gcells = placeGrob(gcells, rectGrob(gp=gpar.fill,
name=paste("cells-fill-r",ii, "-c",jj,sep="")),
row=jj, col=ii)
text.grob.ij = textGrob(label=e[label.ind],
gp=gpar.text, name=paste("cells-label-r",ii,
"-c",j...
2010 Mar 19
2
lattice grob
...lt;- function(p, ...){
grob(p=p, ..., cl="lattice")
}
drawDetails.lattice <- function(x, recording=FALSE){
lattice:::plot.trellis(x$p)
}
p1 <- xyplot(1:10 ~ 1:10)
g1 <- latticeGrob(p1)
grid.draw(g1) # works fine
but,
fg <- frameGrob(layout = grid.layout(1,1))
fg <- placeGrob(fg, g1, row = 1, col = 1)
grid.draw(fg)
Error in UseMethod("depth") :
no applicable method for 'depth' applied to an object of class "NULL"
Ideas are most welcome,
Best regards,
baptiste
> sessionInfo()
R version 2.10.1 RC (2009-12-06 r50690)
i386-apple-darwin9...
2009 Sep 20
1
packGrob and dynamic resizing
...w an old document to use Grid frames,
Creating Tables of Text Using grid
Paul Murrell
July 9, 2003
As a minimal example, I wrote this,
gf <- grid.frame(layout = grid.layout(1, 1), draw = TRUE)
label1 <- textGrob("test", x = 0, just = "left", name="test")
gf=placeGrob(gf, rectGrob(), row = 1, col = 1)
gf=packGrob(gf, label1, row = 1, col = 1)
grid.draw(gf)
grid.edit("test", label = "longer text", grep=T)
I'm a bit lost here, as I was expecting the frame to be automatically
adjusted to fit the new text.
Can anyone point me in the right...
2008 Sep 27
2
multiple plots - editing ggplot2 plot
Hi All,
I am trying to build a composite plot, with multiple categories, using
ggplot2.
In principle, it could be done using facetting, but I do not seem to be able
to get past the defaults, so I try building each plot separately, then
putting them all together using frameGrob and placeGrob.
For this, I need to know how to:
1) format the legend with a different layout (e.g 2 rows by 2 columns,
rather than using the vertical orientation only;
2) draw the numbers on top of the bars (the issue is locating the bars, of
course);
3) extract the definition of the axes (scales, with breaks an...
2007 May 26
1
lattice: aligning independent graphs
I find myself wanting to plot three graphs side by side 'as if' they
were panels -- that is, with the same y-axis limits, no space between
the graphs, and precise vertical alignment of the plot areas. However,
I don't want strip titles; I want each graph to have its own x-axis
label, on the bottom of the plot.
The best way I have so far found to do this is to fake up a data frame
that