Displaying 20 results from an estimated 500 matches similar to: "gList and gTree methods of grid::grobX"
2005 Oct 03
1
Grid: constructing a gTree with grobs that use named viewports from a vpTree
I'm trying to create a layout with named viewports that I can use for
other functions. I create the viewport tree that I want, and a list
of grobs with the viewports describing where they should go.
library(grid)
vp <- vpTree(
viewport(layout=grid.layout(2,2), name="layout"),
children=vpList(
viewport(layout.pos.col = 1, layout.pos.row=1, name="tl"),
2009 Sep 19
1
matrix operations on grobs and grid units
Dear list,
As a minimal test of a more complex grid layout, I'm trying to find a
clean and efficient way to arrange text grobs in a rectangular layout.
The labels may be expressions, or text with a fontsize different of
the default, which means that the cell sizes should probably be
calculated using grobWidth() and grobHeight() as opposed to simpler
stringWidth() and stringHeight().
2011 Apr 26
2
grid stringHeight
Dear all,
I'm puzzled by the behavior of stringHeight in the grid package.
Consider the following test,
library(grid)
test <- function(lab="dog", ...){
g1 <- textGrob(lab)
g2 <- rectGrob(height=grobHeight(g1), width=grobWidth(g1))
gg <- gTree(children=gList(g1,g2), ...)
print(c("height:", convertUnit(stringHeight(lab), "mm",
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)
>
2009 May 21
1
size of point symbols
Dear list,
This might be a topic for r-devel but i may be missing something
obvious.
I don't understand the rationale in the absolute sizes of the point
symbols, and I couldn't find it documented. The example below uses
Grid to check the size of the symbols against a square of 10mm x 10mm.
> checkOneSymbol <- function(pch=0){
> gTree(children=gList(
>
2009 May 21
1
size of point symbols
Dear list,
This might be a topic for r-devel but i may be missing something
obvious.
I don't understand the rationale in the absolute sizes of the point
symbols, and I couldn't find it documented. The example below uses
Grid to check the size of the symbols against a square of 10mm x 10mm.
> checkOneSymbol <- function(pch=0){
> gTree(children=gList(
>
2009 Jun 26
1
gradient fill of a grid.polygon
Dear list,
Following a recent enquiry, I've been playing with the idea of creating a
colour gradient for a polygon, using the Grid package. The idea is to draw a
number of stripes of different colours, using the grid.clip function. Below
is my current attempt at this,
library(grid)
rotate.polygon <- function(g, angle=0){ # utility function, works fine
matR <- matrix(c(cos(angle),
2010 Aug 11
2
help to polish plot in ggplot2
Hi,
I wanted to generate a plot which is almost like the plot generated by the
following codes.
category <- paste("Geographical Category", 1:10)
grp1 <- rnorm(10, mean=10, sd=10)
grp2 <- rnorm(10, mean=20, sd=10)
grp3 <- rnorm(10, mean=15, sd=10)
grp4 <- rnorm(10, mean=12, sd=10)
mydat <- data.frame(category,grp1,grp2,grp3,grp4)
dat.m <- melt(mydat)
p <-
2007 Aug 08
1
Help using gPath
Hi everyone,I'm trying to figure out how to use gPath and the documentation
is not very helpful :(
I have the following plot object:
plot-surrounds::
background
plot.gTree.378::
background
guide.gTree.355:: (background.rect.345, minor-horizontal.segments.347,
minor-vertical.segments.349, major-horizontal.segments.351,
major-vertical.segments.353)
guide.gTree.356::
2009 Sep 27
0
puzzle with drawDetails for a class derived from a gTree
Dear all,
I've tried all sorts of variations discussed in "R graphics" by Paul
Murrell, but I still can't understand how to write a drawDetails
method for a class derived from a gTree.
Below is a minimal, dummy example where two strings are plotted in two
separate viewports. I require the creation of the strings to be
evaluated inside the drawDetails function because my real
2009 Jun 23
2
curvedarrow (some graphics problem)
Hi there,
I just wonder how to draw this kind of picture...
http://www.nabble.com/file/p24158796/b.jpg
http://www.nabble.com/file/p24158796/a.jpg
and this is what i have done
%%%%%
library(shape)
library(diagram)
curve(sin(x),bty="n",-8,8,yaxt="n",ylab="",xaxt="n",type="n",xlab="")
axis(1,labels=F,at=seq(-8,8,1))
2007 Dec 18
1
ggplot2 - getting at the grobs
Dear All,
I continue trying to get several of my plotting functions to use
ggplot, because I really do like the concept of the graphical
objects, and working with them in the abstract.
I am now trying to access the grobs to manipulate using grid.
However, until now all I managed was to get the plot as a gTree
object, and manipulate it as a gTree from there. The problem is that
then it is no
2012 Apr 13
0
Reference Class import() behaviour
Dear All,
In a project I've been working on we've been using Reference Classes
and grid extensively. However, something that I have come across is
that when using the import() method on refclass objects, it does not
work as expected with grid grobs and viewports.
I have prepared test cases that illustrate the point but the general
idea is that importing appears to work fine for
2009 May 31
2
grid.edit() for ggplot2
Dear all,
I'm trying to access and modify grobs in a ggplot2 plot. The basic
idea for raw Grid objects I understand from Paul Murrell's R graphics
book, or this page of examples,
http://www.stat.auckland.ac.nz/~paul/grid/copygrob/copygrobs.R
However I can't figure out how to apply this to a ggplot (basically I
don't know how to write a syntactically correct gPath),
p
2004 Oct 04
7
R 2.0.0 is released
I've rolled up R-2.0.0.tar.gz a short while ago. This is a new version
with a number of new features. See below for the details.
As was the case with R 1.0.0, this new version represents a coming of
age more than a radical change to R. We do plan to celebrate the new
major version with press releases and such.
The release will be available from
2004 Oct 04
7
R 2.0.0 is released
I've rolled up R-2.0.0.tar.gz a short while ago. This is a new version
with a number of new features. See below for the details.
As was the case with R 1.0.0, this new version represents a coming of
age more than a radical change to R. We do plan to celebrate the new
major version with press releases and such.
The release will be available from
2008 Sep 29
2
ggplot 2 - editing in the "panel_1_1" viewport
Hi All,
I am trying to find out how to access the components of a ggplot plot, and I
found this reply from Paul Murrel
http://www.nabble.com/navigating-ggplot-viewports-tt14826352.html#a15056223.
I tried it, and it works.
However, I am trying to develop some functions that will do the drawing
"automatically", and usually I will not know the full name of the grob that
has the layout vp,
2006 Jul 29
3
placing rectangle behind plot
I am trying to create a lattice plot and would like to later, i.e. after
the plot is drawn, add a grey rectangle behind a portion of it.
The following works except that the rectrangle is on top of and
obscures a portion of the chart. I also tried adding col = "transparent"
to the gpar list but that did not help -- I am on windows and
perhaps the windows device does not support
2009 Apr 15
1
savePlot error when type = "eps" or "wmf"
Hello,
When I use savePlot(filename="xy",type="eps") or
savePlot(filename="xy",type="wmf") , I get the following error:
Error in grid.Call("L_textBounds", as.graphicsAnnot(x$label), x$x, x$y, :
Polygon edge not found (zero-width or zero-height?)
This doesn't occur when I change the type to "jpeg" or "bmp". Can
2008 Sep 15
2
Drawing curves
Hi,
Am looking for an R package that will provide the drawing of curves and
arcs of arbitrary shapes to use in illustrations. For example bent lines
and arrows.
Allan.