gf_functions: gf_ plotting functions

Description Usage Arguments Details Examples

Description

These functions provide a formula interface to ggplot2 and various geoms. For plots with just one layer, the formula interface is more compact and is consistent with modeling and mosaic notation. The functions generate a ggplot command string which can be displayed by setting verbose = TRUE as an argument.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
gf_point(placeholder = NULL, formula = NULL, data = NULL, geom = type,
  verbose = FALSE, add = FALSE, ...)

gf_jitter(placeholder = NULL, formula = NULL, data = NULL, geom = type,
  verbose = FALSE, add = FALSE, ...)

gf_line(placeholder = NULL, formula = NULL, data = NULL, geom = type,
  verbose = FALSE, add = FALSE, ...)

gf_path(placeholder = NULL, formula = NULL, data = NULL, geom = type,
  verbose = FALSE, add = FALSE, ...)

gf_density(placeholder = NULL, formula = NULL, data = NULL, geom = type,
  verbose = FALSE, add = FALSE, ...)

gf_density_2d(placeholder = NULL, formula = NULL, data = NULL,
  geom = type, verbose = FALSE, add = FALSE, ...)

gf_hex(placeholder = NULL, formula = NULL, data = NULL, geom = type,
  verbose = FALSE, add = FALSE, ...)

gf_hline(placeholder = NULL, formula = NULL, data = NULL, geom = type,
  verbose = FALSE, add = FALSE, ...)

gf_abline(placeholder = NULL, formula = NULL, data = NULL, geom = type,
  verbose = FALSE, add = FALSE, ...)

gf_hex(placeholder = NULL, formula = NULL, data = NULL, geom = type,
  verbose = FALSE, add = FALSE, ...)

gf_boxplot(placeholder = NULL, formula = NULL, data = NULL, geom = type,
  verbose = FALSE, add = FALSE, ...)

gf_freqpoly(placeholder = NULL, formula = NULL, data = NULL,
  geom = type, verbose = FALSE, add = FALSE, ...)

gf_histogram(placeholder = NULL, formula = NULL, data = NULL,
  geom = type, verbose = FALSE, add = FALSE, ...)

gf_text(placeholder = NULL, formula = NULL, data = NULL, geom = type,
  verbose = FALSE, add = FALSE, ...)

gf_counts(placeholder = NULL, formula = NULL, data = NULL, geom = type,
  verbose = FALSE, add = FALSE, ...)

gf_bar(placeholder = NULL, formula = NULL, data = NULL, geom = type,
  verbose = FALSE, add = FALSE, ...)

gf_frame(placeholder = NULL, formula = NULL, data = NULL, geom = type,
  verbose = FALSE, add = FALSE, ...)

Arguments

placeholder

Ignore this argument. See details.

formula

A formula describing the x and y (if any) variables and other aesthetics in a form like y ~ x + color:red + shape:sex + alpha:0.5

data

A data frame with the variables to be plotted

geom

A way to specify ggplot geoms that are not aliased to gf functions.

verbose

If TRUE print the ggplot2 command in the console.

add

If TRUE then construct just the layer with no frame. The result can be added to an existing frame.

...

Other arguments such as position="dodge",

Details

These gf_ functions are written to interact with ggplot objects. The placeholder argument is part of this interaction system; the end user can ignore it.

Examples

1
2
3
4
gf_point(mpg ~ hp + color:cyl + size:wt, data = mtcars)
gf_line(mpg ~ hp + group:cyl, data = mtcars) + facet_grid(~ am)
gf_histogram(~ Sepal.Length + fill:Species, data = iris)
gf_text(Sepal.Length ~ Sepal.Width + label:Species + color:Species , data = iris)

Example output

Loading required package: ggplot2
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

statisticalModeling documentation built on May 29, 2017, 11:56 p.m.