Displaying 6 results from an estimated 6 matches for "editgrob".
2009 Jun 26
1
gradient fill of a grid.polygon
...nrow = 2)
gravity.x = unit(mean(g$x),"npc")
gravity.y = unit(mean(g$y),"npc")
x.center = convertX(g$x - gravity.x ,"npc",TRUE)
y.center = convertY(g$y - gravity.y ,"npc",TRUE)
new.xy <- matrix(c(x.center, y.center),
ncol=2) %*% matR
editGrob(g, x=unit(new.xy[,1],"npc") + gravity.x,
y=unit(new.xy[,2],"npc") + gravity.y)
}
gradient.polygon <- function(g, n=100,
cols=colorRampPalette(c("#E41A1C", "#377EB8", "#4DAF4A", "#984EA3"))(n),
alpha=0.5,
stripe=FALS...
2005 Oct 03
2
grob questions
If I run the following example from:
http://www.stat.auckland.ac.nz/~paul/grid/doc/grobs.pdf
> grid.newpage()
> pushViewport(viewport(w = 0.5, h = 0.5))
> myplot <- gTree(name = "myplot", children = gList(rectGrob(name = "box",
+ gp = gpar(col = "grey")), xaxisGrob(name = "xaxis")))
> grid.draw(myplot)
>
2005 Nov 02
0
Placing a grob in multiple viewports
Hi all,
What's the best way of placing a grob into muliple viewports? I've
been using code like:
plot_grob_matrix <- function(gm, type=deparse(substitute(gm))) {
grid <- expand.grid(x=1:nrow(gm), y=1:ncol(gm))
do.call(gList,mapply(function(x,y) editGrob(gm[[x,y]], vp=vp_path(x,
y, type)), grid$x, grid$y, SIMPLIFY=FALSE))
}
vp_path <- function(row, col, type) {
vpPath("layout", paste(type, row, col, sep="_"))
}
to place a matrix of grobs into a similar looking matrix of viewports
(constructed by another function). This wo...
2007 Jun 29
1
Print grid/ggplot to a metafile
Dear UseRs called Hadley, or Paul,
I am trying to print an edited ggplot2/grid graphics to a metafile. With the
commented line below it works, but when I edit the plot by uncommenting the
line, it fails, because it's illegal to have 2 graphics in a metafile. It
works with pdf, but even then I get two plots, which is a nuisance.
I found a workaround by using windows(); savePlot, but it only
2009 Mar 21
1
Forestplot () box size question
...cks <- c(exp(clip[1]), ticks)
if (max(upper, na.rm = TRUE) > clip[2])
ticks <- c(ticks, exp(clip[2]))
xax <- xaxisGrob(gp = gpar(cex = digitsize, col = col$axes),
at = log(ticks), name = "xax")
xax1 <- editGrob(xax, gPath("labels"), label =
format(ticks, digits = 2))
grid.draw(xax1)
}
}
else {
if (is.null(xticks)) {
grid.xaxis(gp = gpar(cex = digitsize, col = col$axes))
}
else if (length(xticks)) {
grid.xaxis(a...
2007 Oct 25
1
Strange behavior with time-series x-axis
I recently called plot(x,y) where x was an array of POSIXct timestamps,
and was pleasantly surprised that it produced a nice plot right out of
the box:
z <- as.POSIXct(c("2006-10-26 08:00:00 EDT","2007-10-25 12:00:00 EDT"))
x <- seq(z[1],z[2],len=100)
y <- 1:100
plot(x,y,type="l")
The X axis had nice labels, one tick mark every other month. (Plotting
on