Since I've gotten few complaints or suggestions for new material from
the last version of this document (knock wood), I'm proposing this as
the final version subject to approval by list members.
I did make an addition in the section on continuous scales in response
to a couple of recent inquiries about defining one's own scales (see
the bottom half of p. 31 to the top of p. 33), so please check that
out and let me know if you think it can be improved.
Hadley mentioned wanting to post this to the regular ggplot2 group
sometime next week, so if you want to comment on it, I'd prefer that
you do so before the weekend is out. Is there someplace we can host
the color and B/W versions when it's finalized - the ggplot2 wiki,
perhaps?
Thanks to everyone who commented on earlier versions and improved the
(nearly) final product.
Dennis
I'm not sure if it's useful to mention them in this document, but I
believe v. 0.90 introduced
annotation_custom
annotation_map
annotation_raster
Thanks for the very useful reference,
b.
library(ggplot2)
p <- qplot(mpg, wt, data = mtcars) + theme_bw()
## color gradient
rainbow <- matrix(hcl(seq(0, 360, length = 300 * 50), 80, 70), ncol = 300)
## scaled down map of NZ
library(maps)
nz <- transform(map_data("nz"), long = scale(long) + 15,
lat = scale(lat)/5 + 2)
# Inset plot
g <- ggplotGrob(p)
p +
annotation_raster(rainbow, -Inf, Inf, -Inf, Inf) +
geom_point() +
annotation_map(nz, fill = "NA", colour = "grey50") +
annotation_custom(grob = g, xmin = 25, xmax = 35, ymin = 3.5, ymax = 5)
Cheers,
b.
On 11 February 2012 23:13, baptiste auguie
Sa-weeeeeeeeeeettt! That's a keeper! :)
Thanks,
Dennis
rainbow <- t(hcl(seq(0, 360, length = 300), 80, 70))
Cheers,
b.
Dennis,
I didn't make it all the way through it yet, but I did find one coding issue...
Page 3:
Usersnolongerhavetoworryaboutthevariablename/aestheticnamebugletthatplagued earlier versions, which was a particular problem when a faceting variable was the name of an aesthetic (e.g., colour or size). You can now expect that code like the following will work: «code0,eval=FALSE»= ggplot(df, aes(x, y, group = group, colour = color)) @
Best,
Dennis
baptiste
Hadley
--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/