similar to: transforming output of grid.locator() to coordinates of a leaf viewport

Displaying 20 results from an estimated 6000 matches similar to: "transforming output of grid.locator() to coordinates of a leaf viewport"

2007 Dec 10
2
Viewport and grid.draw
Hi Deepayan and everyone, I need to add a common legend to a group of latice graphs, I have tried different ways using viewport and grid.draw without success. Here is what I have: plot.new() library(grid) library('IDPmisc') print(plot1, split=c(1,1,2,4), more=TRUE) print(plot4, split=c(2,1,2,4), more=TRUE) print(plot2, split=c(1,2,2,4), more=TRUE) print(plot5, split=c(2,2,2,4),
2009 Sep 24
1
Creating grid graphics with grid.layout
Hi, I recently created a function which uses grid with a viewport constructed with grid.layout() to position four plots on a plot device. My question is what's the best way to programatically traverse each element of the viewport? The grid is 5x5 and the four plots occupy positions (2,2), (4,2), (2,4), and (4,4). Here's the viewport code: pushViewport( viewport(
2012 Feb 16
2
Defining a viewport scale in {Grid}
Am just feeling my way into the grid library, and cannot figure out how to define the plot limits. 3/5 of the example polygons below plot in the default 0-1 range viewport. But when I try to redefine the viewport the polygons plot in the same places. I also get the same result without employing push/pop. (As you can see from the scale I'm trying to introduce, I want to plot map polygons.)
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),
2011 Aug 03
0
How to calculate the number of times a given string can be displayed in the width of a grid viewport
There was too many spelling mistakes in my original post so I have decided to re-submit it. So here is it Dear R users, I am trying to determine how many characters can be displayed within the width of an open grid viewport. Unfortunately, the arithmetic operation that seems obvious in this case is not permitted with unit objects (see example below). Although there is a brute force way to get
2005 Oct 15
2
grid.edit problem
I am having a problem in editing a grob. It works ok if I try to shift the grob using npc coordinates but if I do the same thing using native coordinates the grob disappears. What is wrong? library(grid) grid.newpage() # create viewport pushViewport(viewport(xscale = c(100,200), name = "X")) # draw vertical line grid.lines(150, 0:1, default.units = "native", name =
2008 Jul 28
1
grid.ls() after grid.remove() fails
Dr Murrell and others, It seems grid.ls() fails after any use of grid.remove(). It gives an infinite recursion error even in the simplest cases, and no matter what arguments are passed to grid.ls. > library(grid) > grid.newpage() > grid.lines(name="foo") > grid.ls() foo > grid.remove("foo") > grid.ls() Error: evaluation nested too deeply: infinite recursion
2007 Oct 24
1
Rotated viewports in Grid
Hi all, I'm trying to generate a plot containing a scatterplot, with marginal densityplots for x and y. However, when I try to generate a vertical densityplot, I get the message "warning: can't clip to rotated viewport", and nothing shows up. I'm probably misunderstanding how viewports are meant to be used, so if someone could give me a hint, I'd be most grateful. my
2008 Aug 08
2
gridBase and new.page() / grid.newpage()
Hello all, I'm trying to write a function using the gridBase package. I'd like to push several base subplots to a larger plot constructed with grid. However, I'm having trouble getting consistent results when running the function when the plotting window (quartz) is closed, when it is left open and the plot function is repeated to the same window, and when the output is saved to a
2008 Sep 01
1
npc to native coordinates for xyplot
Hello, I am having trouble adding symbols to grid graphics. I am able to create a lattice scatterplot using xyplot, which has a range from -15:15 in both the X and Y directions. However, when I try to add circles and text to this graph using grid.circle() and grid.text(), they are offset using the default npc coordinates. Nothing happens when I pass the parameter default.units="native"
2009 Jun 24
1
parallel rotated strips with color gradient
Hi, I want to produce two parallel rotated strips with color gradient. So far, the sample strip is something produced by this: pushViewport(viewport(x = unit(0.638, "npc"), y =unit(0.386, "npc"), width=.62, height=0.006, angle=137.2)) grid.rect(y=100:1/100, just="top", gp=gpar(col=NA, fill=colorRampPalette(c("lightgray",
2012 Oct 19
1
grid(Base): How to avoid "Figure region too small and/or viewport too large" by specifying 'relative' units?
Dear grid-expeRts, The goal: I would like to construct a plot (matrix) with grid and gridBase, which consists of four "sub-plots". The sub-plots should have a square plotting region as one would force with par(pty="s") in base graphics. The problem: I don't get a square plotting region, not even by specifying pty="s" in par(). Indeed, if you display the grid
2008 Mar 04
1
grid.layout?
platform x86_64-unknown-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu status major 2 minor 6.2 year 2008 month 02 day
2011 Mar 04
1
Units and dimensions in grid object
Dear R-users, As far as I understand, when one defines the width of a rectGrob call using a 'npc' unit, the width of the object is proportional to the width of the current viewport. Is there a way to refer to the height (or width) of the viewport when defining the width (or height) of the rectGrob object? Thanks Sebastien [[alternative HTML version deleted]]
2011 Feb 15
1
gList and gTree methods of grid::grobX
Dear all, In an attempt to draw fill patterns in grid graphics, I have encountered a behavior of grobX that I cannot understand from the documentation. Consider this, library(grid) ## gTree g1 <- gTree(children=gList( rectGrob(0.5,0.5, width=unit(0.8,"npc"), height=unit(2,"cm")), circleGrob(r=0.3)), vp=viewport(0.5,0.5)) ##
2008 Oct 23
1
Getting the panel location of a xyplot matrix using a mouse click in a GDCanvas
Hi: I would like to find out the panel of a xyplot matrix where a mouse clicked. I know this functionality is already bundled in trellis.focus but I can't use it because I am coding a stand alone application in Java using with GDCanvas as a graphics device. I tried calling trellis.focus from Java with: re.eval("t = trellis.focus()")); However it did not work for an embedded
2009 Sep 02
2
combining grid.text, expression and variables
Dear R-users, I am trying to use the grid.text and expression functions to display several character strings and plotmath text on a viewport. Some strings can include a variable portion (PI.limits in the following example), which I thought could be implemented by combining the bquote and the expression functions. Unfortunately, my expressions do not seem to be evaluated. I would greatly
2007 Sep 13
1
minimize white space around lattice plot
Dear list, I'm trying to produce a plot via xyplot with minimal sourounding white space. However, I cannot find the options in xyplot, ps.options or wherever which prevents lattice from drawing quite some white space around my plot. However, this is quite a problem for me as I want to produce an inset plot inside another lattice-plot. I'm using the panel function to open a viewport and
2009 Mar 21
1
Forestplot () box size question
Hi All, I have been able to modify the x-axis to start at zero by adding xlow and xhigh parameters; that was pretty simple. I have been unable to find the location of the code that would turn off the information weighting of the box size (I have smaller randomized trials getting less weight than a much larger non-randomized trial). The function is forestplot() from rmeta. Thanks for any
2008 Aug 06
1
grid layout scaling viewport width based solely on height
Hello all, I'm trying to write a function that produces a main plotting region with several square plots along the right side. Ideally the size of right side plots will scale only with the height of the entire plot, yet never overlap with another secondary plot. The following two snippets get close, however, as I resize the plot horizontally the right side plots (green squares) get smaller