Displaying 20 results from an estimated 1300 matches similar to: "ggplot2: remove minor-horizontal guide before drawing"
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
2010 Mar 19
2
lattice grob
Dear list,
I'm trying to arrange various grid objects on a page using a
frameGrob. It works fine with basic grobs (textGrob, gTree, etc.), and
also with ggplot2 objects using the ggplotGrob() function. I am
however stuck with lattice. As far as I understand, lattice produces a
list of class trellis, which is eventually displayed using the
plot.trellis method. I am not sure if/how one can
2008 Aug 29
1
ggplot2: Changes to grobs not saved to file output
Hello,
Maybe I missed something - most likely .:-(
I create a gplot and then makes some changes to the plot using grid graphics
functions. These changes show up on the display OK, but when I save using
ggsave() the grid changes do not show up. How do I save the plot with these
changes?
Thanks in advance.
--
View this message in context:
2008 Nov 24
1
ggplot2: positioning legend on top of plot
Hi,
With ggplot2 v0.8, how do I position a legend on top of the plot. Things
like
p + opts(legend.position="top")
work ok. But
p + opts(legend.position=c(0.5,0.5))
gives
Error in as.character(x) :
cannot coerce type 'closure' to vector of type 'character'
so obviously I should be giving a string instead but I can't figure out
what it should be.
Thanks,
2009 May 16
1
ggplot2: annotating plot with mathematical formulae
Hi,
Is there a way of annotating a ggplot plot with mathematical formulae?
I can do
geom_text(aes(label="some text", ...
but I can't do
geom_text(aes(label=expression(x^{n-1}), ...
It gives the error
Error: geom_text requires the following missing aesthetics: label
Is there a convenient equivalent?
Cheers,
Paul
2004 Mar 15
2
R equiv to proc gremove in maps package
Is there an R equivalent to SAS's proc gremove? You would use this procedure to combine the units on an existing map, for example to build a map of Metropolitan Statistical Areas (MSAs) from the [US] counties dataset where the internal boundries surround the MSAs (which are groups of counties) rather than the individual counties. I can imagine the mechanism would be to find and erase the
2011 Nov 15
1
grid.arrange, grid.layout - legend, global y axis title
Hello,
I created several plot with ggplot2 dev mode.
Now I want to combine the plots in a grid
e.g. 2x2 with a fixed size of the output.
What I am doing at the moment is:
grid.newpage()
pushViewport(viewport(layout = grid.layout(nrow=2, ncol=2,
widths = unit(c(7.5,6.5), "cm"),
heights = unit(rep(5, 2), "cm"))))
print(plot1, vp = viewport(layout.pos.row = 1,
2004 Nov 18
4
adjusting the map of France to 1830
I'm doing some analyses of historical data from France in 1830 on 'moral
statistics' that I'd like to
show on a map. I've done most of my analyses in SAS, but a few things
would work better in R.
To do this, I have to adjust the modern map,
library(maps)
map('france')
to adjust for changes in departments (86 in 1830, to 97 now). I've read
the documentation
2009 Jun 02
1
lattice: horizontal alignment of labels in key
Dear R users
I have problems horizontally aligning labels in keys of lattice plots when the
labels make use of plotmath. Here's a self-contained example:
dat <- data.frame(x = rnorm(10),
y = rnorm(10),
z = factor(rep(c("a", "b"), each = 5)))
xyplot(y ~ x, dat, groups = z,
auto.key = list(columns = 2,
text =
2008 Jul 30
1
function to transform response of a formula
Hi,
I am trying to write a function which takes a formula as input and
outputs a new formula with a different response while keeping the rest
of the formula the same.
I.e.
respapply : ( y ~ a+b ) -> ( f(y) ~ a + b )
I have tried the following but it doesn't work. The terms become
invalid as shown below.
respapply <- function(fm, f) {
fm[[2]] <- f(eval(fm[[2]]))
fm;
2009 May 07
2
64 bit R double precision
Hi,
If R is compiled for a 64 bit platform, does the double data type make
use of the additional precision or is it set at a fixed length?
Thanks,
Paul
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
2008 Jul 27
1
Lattice wireframe: How to avoid drawing lines around polygons when using shade=TRUE
I am using wireframe from the lattice package, with the shade option set
to TRUE. When I output to PDF or Postscript, a line gets drawn around
each polygon of my surface which causes ugly Moir? effects and doesn't
make sense in my application (think the plot of Maunga Whau--gridlines
don't make sense). This does not happen when I display on the screen--
then I just get the surface as
2006 Jul 03
1
ggplot: a new system for drawing graphics in R
ggplot provides a new system for drawing graphics in R, based on the
Grammar of Graphics. It combines the advantages of both base and
lattice graphics: conditioning and shared axes are handled
automatically, and you can still build up a plot step by step from
multiple data sources. It also implements a more sophisticated
multidimensional conditioning system and a consistent interface to map
data
2006 Jul 03
1
ggplot: a new system for drawing graphics in R
ggplot provides a new system for drawing graphics in R, based on the
Grammar of Graphics. It combines the advantages of both base and
lattice graphics: conditioning and shared axes are handled
automatically, and you can still build up a plot step by step from
multiple data sources. It also implements a more sophisticated
multidimensional conditioning system and a consistent interface to map
data
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)
>
2011 Jul 27
2
Creating a flat legend 'grob' for lattice xyplot
Hi,
I want my xyplot legend to be flat, not tall, and there seems to be no way
for xyplot's auto.key and key elements to do this: I tried many, many
permutations of what I could find in the archives and reading the
documentation. If there there's a way to make it flat, please tell me what
the magic incantation is.
Here's a simple example of what I like to see. The xyplot will be a
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
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 =