add_c_scales: Add convention scales to ggplot object

Description Usage Arguments Examples

View source: R/ggconventions.r

Description

add_c_scales adds convention scales to ggplot object currently needed if facets are specified otherwise scales are automatically dispatched

Usage

1

Arguments

gg

A ggplot object, mappings must be simple matches to fields

Examples

 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

trevorld/ggconventions documentation built on May 25, 2019, 9:25 a.m.