Re: [R] Converting qqplot2 qplot() to grammar?

From: hadley wickham <h.wickham_at_gmail.com>
Date: Tue, 13 May 2008 09:22:38 -0500

On Mon, May 12, 2008 at 3:31 PM, B. Bogart <bbogart_at_sfu.ca> wrote:
> Hello all,
>
> I've been using the following qplot command:
>
> qplot(pixX,pixY, data=som, geom="tile", fill=rgb) +
> scale_fill_identity() + opts(aspect.ratio = .75) + facet_grid(unitX ~ unitY)
>
> Now I would like to convert it into the explicit ggplot grammar, so I
> can remove the extras: axes, labels, background, borders, facet labels,
> and extra white-space around the plot. (If anyone has suggestions on
> removing these please let me know)

You're missing one thing. You want:

  layer(data = somdf, geom = "tile", aes(fill=rgb))

(i.e. there's an aes function wrapped around the fill). I'd probably use a few more of the built in defaults to get:

  geom_tile(aes(fill = rgb))

> The other issue I'm having is that the above seems to create multiple
> plots, another, apparently identical, plot gets drawn after I call
> dev.off(). I have no idea why this would be so.

Could you provide a fuller description of what you're trying to do?

> Setting name and breaks to " " seems like a hack to get rid of the axis
> stuff, is there a better way?

Not at the moment.

> Oh, and I can't find documentation for opts() on the ggplot2 website,
> where is it available?

Just in R at the moment - see ?opts.

Hadley

-- 
http://had.co.nz/

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Tue 13 May 2008 - 15:01:24 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 13 May 2008 - 21:31:07 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive