search for: grobheight

Displaying 20 results from an estimated 20 matches for "grobheight".

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", "y"))) grid.draw(gg) } grid.newpage() test() test(expression(dog), vp=viewport(x=0.6)) ## notice how the dog's tail is being cut off...
2006 Apr 06
2
key position in trellis plotting area
...;),cex=c(1.2,1,1 ,1,1,1,0.2))) keyArgs$between <- c(1,0,5) keyArgs$background <- "white" keyArgs$border <- TRUE drawKeyArgs <- list(key=keyArgs,draw=FALSE) keyArgs$draw <- FALSE key <- do.call("draw.key",drawKeyArgs) vp1<-viewport(x=1,y=1,height=unit(1,"grobheight",key),width=unit(1,"grobwidt h",key),just=c("right","top")) pushViewport(vp1) grid.draw(key) popViewport() If I embed the call to draw.key into the panel function, where presumably the plotting area is the current viewport, then it works. panel.test &l...
2004 Nov 08
3
location of key in panels of trellis plot
Hi, I want to insert a key into each panel of a trellis plot, which I can do with a custom panel function that calles draw.key. The problem arises because I want the top right hand corner of the key to start in the top right hand corner of the panel. If you run my code below, you can see that the key appears in the center of each panel. This is because the default viewport in draw.key is the
2009 Sep 19
1
matrix operations on grobs and grid units
...al 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(). (Correct?). The input of this function is a vector of labels, which are arranged into a matrix layout. Below is my current version, followed by a few questions. e = expression(alpha,"testing very large width", hat(beta), integral...
2007 Mar 25
1
controlling panel.width and panel.height in viewports
...ch variety of levelplot. So I tried to capture the viewport height and width and print the levelplot within a region which reflects the aspect ratio of the plot. I run into an error message as below: width.vp <- convertWidth(grobWidth(grid.rect()), 'cm') height.vp <- convertWidth(grobHeight(grid.rect()), 'cm') width.vp;height.vp # this works if(asp.ratio.1 < 1) {height.vp <- unit(as.numeric(height.vp)*asp.ratio.1, "cm")} if(asp.ratio.1 > 1) {width.vp <- unit(as.numeric(width.vp)/asp.ratio.1, "cm")} width.vp;height.vp # this also work (ie ret...
2006 Apr 06
3
skipping rows in trellis key
Hi, I would like to add a key to my trellis plot using draw.key. Here is what I want: 3 x 6 key where the first row is a header. row 1: empty, "S-R Mapping", "R^2" row 2: pch=17, "Color", 0.951 row 2: pch=17, "Shape", 0.934 ect... The problem is that I would like the cell in the upper left corner to be empty (a placeholder) with the remaining
2005 Dec 07
0
organizing plot drawing routines; creating complex expressions
...s,...);panel.superpose(x,y,...)} print(do.call("xyplot",arg)) key <- draw.key(list(background="white",border=TRUE,text=list(lab=levels(arg$data$e xpected.hierarchyTo)),lines=list(col=arg$col,pch=arg$pch,lty=arg$lty,lwd=arg $lwd))) vp<-viewport(x=0.9,y=grobHeight(key)+unit(0.07,"npc"),just=c("right","top"), width=grobWidth(key),height=grobHeight(key)) pushViewport(vp) grid.draw(key) As you can see each routine is a sequence of commands required to draw a single plot. Each routine is separated in th...
2009 Jun 26
1
gradient fill of a grid.polygon
...avity.y) } gradient.polygon <- function(g, n=100, cols=colorRampPalette(c("#E41A1C", "#377EB8", "#4DAF4A", "#984EA3"))(n), alpha=0.5, stripe=FALSE, angle=0){ vp = viewport(angle = angle) g = rotate.polygon(g, - angle) gx <- grobWidth(g) gy <- grobHeight(g) dx <- unit(convertX(gx, "npc", valueOnly = TRUE)/(n-1), "npc") # width of the stripes startx <- min(g$x) starty <- min(g$y) for(ii in seq(1, n)){ grid.clip(x= startx + (ii-1) * dx , y=starty, width= 1.0*dx, # fudge factor of 1.2 seems needed to overla...
2001 Sep 21
2
new versions of grid and lattice
...he bug!). 2. Added grid.line.to() and grid.move.to(). These allow drawing BETWEEN different coordinate systems. See example in inst/doc/demo3.ps. 3. Added some more demonstrations to the doc directory. 4. Added more test code to the tests directory. 5. Added "grobwidth" and "grobheight" units. See the document grid/inst/doc/advanced/parentchild.ps 6. Added more detailed documentation to grid/inst/doc/advanced. This stuff is not necessarily very friendly for the reader, but may be useful if you're tearing your hair out wondering why some strange effect is occu...
2001 Sep 21
2
new versions of grid and lattice
...he bug!). 2. Added grid.line.to() and grid.move.to(). These allow drawing BETWEEN different coordinate systems. See example in inst/doc/demo3.ps. 3. Added some more demonstrations to the doc directory. 4. Added more test code to the tests directory. 5. Added "grobwidth" and "grobheight" units. See the document grid/inst/doc/advanced/parentchild.ps 6. Added more detailed documentation to grid/inst/doc/advanced. This stuff is not necessarily very friendly for the reader, but may be useful if you're tearing your hair out wondering why some strange effect is occu...
2003 Dec 09
1
Key for custom lattice panel function
Hi all, I've created a custom lattice panel function for levelplot - instead of representing z by colour, it plot circles with radius proportional to z (in the style of the map plots of Jacques Bertin). I'm happy to email an example graph to anyone interested. The problem is now to create a key for the plot. This is difficult because all of the other lattice plots convey
2011 Mar 04
2
Creating a .png with just an expression() in it
Hey, I'm trying to create an image file with the results of a regression analysis. In TeX, the line would be something like: $ size = 0.34 + 4.3 var_1 $ Can I create a plot window with just this line in it? I tried playing around with plot.new() or dev.new(), but didn't really find something that worked. Thanks in advance, Alex -- alexx at alexx-fett:~$ vi .emacs
2003 Apr 27
2
bug and proposed fix in print.trellis 1.7.0 (PR#2859)
This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. ---1678264062-154654637-1051422990=:2626055 Content-Type: TEXT/PLAIN; charset=US-ASCII ---1678264062-154654637-1051422990=:2626055 Content-Type: TEXT/PLAIN; charset=US-ASCII;
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
2008 Oct 17
1
Using key.opts in Ecdf/labcurve (Hmisc package)
I'm presumably missing something very obvious, but how does one use the key.opts argument in labcurve (via Ecdf)? In this example, I want the key to be big and have a blue background, but it isn't and doesn't. ch <- rnorm(1000, 200, 40) sex <- factor(sample(c('female','male'), 1000, TRUE)) Ecdf(~ch, group=sex, label.curves=list(keys=c("f",
2004 Apr 12
1
R 1.9.0 is release
...grob name is used to uniquely identify a "drawn" grob (i.e., a grob on the display list). + grid.edit() and grid.pack() now take a grob name as the first argument instead of a grob. (Actually, they take a gPath - see below) + the "grobwidth" and "grobheight" units take either a grob OR a grob name (actually a gPath - see below). Only in the latter case will the unit be updated if the grob "pointed to" is modified. In addition, the following features are now possible with grobs: + grobs now save()/load() like any...
2004 Apr 12
1
R 1.9.0 is release
...grob name is used to uniquely identify a "drawn" grob (i.e., a grob on the display list). + grid.edit() and grid.pack() now take a grob name as the first argument instead of a grob. (Actually, they take a gPath - see below) + the "grobwidth" and "grobheight" units take either a grob OR a grob name (actually a gPath - see below). Only in the latter case will the unit be updated if the grob "pointed to" is modified. In addition, the following features are now possible with grobs: + grobs now save()/load() like any...
2007 Aug 05
1
Any "special interest" in R/pic interface?
Hi Folks, I'm wondering if there are people out there who would be interested in what would be involved in developing an interface between R graphics and the 'pic' language. Explanation; 'pic' has been part of the Unix 'troff' typesetting suite since very early days (1970s), and also of the GNU troff: 'groff'. Its function is to act as a preprocessor,
2005 Apr 18
1
R-2.1.0 is released
...s or user-interrupts during drawing (i.e., not leave you in a strange viewport or with strange graphical parameter settings). - New function grid.refresh() to redraw the grid display list. - New function grid.record() to capture calculations with grid graphics output. - grobWidth and grobHeight ("grobwidth" and "grobheight" units) for primitives (text, rects, etc, ...) are now calculated based on a bounding box for the relevant grob. NOTE: this has changed the calculation of the size of a scalar rect (or circle or lines). - New arguments 'warn' a...
2005 Apr 18
1
R-2.1.0 is released
...s or user-interrupts during drawing (i.e., not leave you in a strange viewport or with strange graphical parameter settings). - New function grid.refresh() to redraw the grid display list. - New function grid.record() to capture calculations with grid graphics output. - grobWidth and grobHeight ("grobwidth" and "grobheight" units) for primitives (text, rects, etc, ...) are now calculated based on a bounding box for the relevant grob. NOTE: this has changed the calculation of the size of a scalar rect (or circle or lines). - New arguments 'warn' a...