Description Usage Arguments Examples
View source: R/ggconventions.r
add_c_scales
adds convention scales to ggplot object
currently needed if facets are specified
otherwise scales are automatically dispatched
1 | add_c_scales(gg)
|
gg |
A ggplot object, mappings must be simple matches to fields |
1 2 3 4 5 6 7 8 9 10 | require("ggplot2")
source(system.file("conventions/gender.R", package="ggconventions"))
data("gender_data", package="ggconventions")
gg <- qplot(x=class, y=survivors, colour=gender, shape=gender, geom="blank",
data=c_transform(gender_data)) + geom_point(size=5)
gg
# The following are equivalent
add_c_scales(gg + facet_grid(. ~ gender))
gg + facet_grid(. ~ gender) + scale_colour_gender() + scale_shape_gender()
# gg + facet_grid(. ~ gender) # gives an error
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.