Displaying 20 results from an estimated 5000 matches similar to: "grid.ls() after grid.remove() fails"
2008 Jan 15
1
navigating ggplot viewports
list(...)
I can not get at the grid viewports in a ggplot2 plot.
I know there is supposed to be a viewport called "panel_1_1" but
downViewport() can't find it. Has the viewport been popped?
I had a quick look at the functions involved (eg ggplot_plot)
but there is no obvious problem there.
> library(ggplot2)
> qplot(1:10, 1:10)
> current.viewport()
viewport[ROOT]
>
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),
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(
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 =
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"),
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 Jun 01
1
transforming output of grid.locator() to coordinates of a leaf viewport
Short form:
How do I transform the output of grid.locator() (or
grid.locator(unit='npc')) to the native (or npc) coordinates of a viewport other
than the top-level viewport?
Thanks in advance. -Ben
Long form:
I would like the user to be able to click anywhere on the R
graphics window. I would then like to figure out which leaf viewport the user
clicked in and compute the native
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
2009 Sep 28
2
dichromat, regexp, and grid objects
Dear list,
The dichromat package defines a dichromat function which "Collapses
red-green color distinctions to approximate the effect of the two
common forms of red-green colour blindness, protanopia and
deuteranopia."
library(dichromat)
library(grid)
colorStrip <-
function (colors = 1:3, draw = TRUE)
{
x <- seq(0, 1 - 1/length(colors), length = length(colors))
y <-
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,
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"
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),
2012 Aug 07
1
Styling gridExtra's title and left labels
Hi,
I'm using the gridExtra package to combine some graphs like in the
arrangeGrob example. Each of the graphs has a title but they appear much
larger than the overall combined plot title and left axis label. Does anyone
know how I can control the style / size of the gridExtra labels?
library(gridExtra)
library(ggplot2)
dsamp <- diamonds[sample(nrow(diamonds), 1000), ]
p1 <-
2003 May 12
3
grid - deleting and erasing grobs?
Hello!
Don't quite understand how can I delete grobs and simultaneously erase
graphic output they produce. I first change grob's "vp" field to null
(grid.edit(gr,vp=NULL)) to erase it and then call rm(gr) (as grobs are
external pointers I'm not shure what this method actually frees
allocated memory).
May be there is simpler method?
Does garbage collector have any effect
2003 May 12
3
grid - deleting and erasing grobs?
Hello!
Don't quite understand how can I delete grobs and simultaneously erase
graphic output they produce. I first change grob's "vp" field to null
(grid.edit(gr,vp=NULL)) to erase it and then call rm(gr) (as grobs are
external pointers I'm not shure what this method actually frees
allocated memory).
May be there is simpler method?
Does garbage collector have any effect
2006 Jun 14
2
positioning of separate y-axis labels in xyplot
I like the functionality provided by outer=TRUE, but when it comes time
to place separate xlabs or ylabs, I always end up 'eyeballing' it on a
case-by-case basis. For example,
##begin example
require(lattice)
cars.lo <- loess(dist ~ speed, cars)
print(xyplot(cars.lo$residuals+cars.lo$fitted~cars.lo$x,
strip=FALSE,
outer=TRUE,
layout=c(1,2),
2011 Nov 10
1
grid.pack and grid.frame bewilder me
Hello R friends,
I get quite confused in using the grid graphic function grid.pack( )
and grid.frame ( ). Here is a simple example:
library(grid)
grid.frame(name="frame1")
grid.pack("frame1",rectGrob(width=unit(0.5,"npc"),
height=unit(0.5,"npc"), gp=gpar(col="red")))
what I expect is a rectangle with half the default device's
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
2005 Feb 18
1
Examples of multiple key grobs
The xyplot help page gives quite a lot of information how to use key
and indicates that legend needs to be used if multiple keys are
needed. However, it gives only a brief description of what the grob
needs to contain to do multiple keys.
I've only used the occasional grid function in panel functions, so I
don't have much of a sense of how grobs are constructed. I've been
unable to
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