geom_vase: Side by side vase plots.

Description Usage Arguments Examples

Description

Side by side vase plots.

Usage

1
2
3
geom_vase(mapping = NULL, data = NULL, stat = "vase",
  position = "dodge", show.legend = NA, inherit.aes = TRUE, width = 0.9,
  alpha = 0.25, ...)

Arguments

mapping

Set of aesthetic mappings created by aes or aes_. If specified and inherit.aes = TRUE (the default), is combined with the default mapping at the top level of the plot. You only need to supply mapping if there isn't a mapping defined for the plot.

data

A data frame. If specified, overrides the default data frame defined at the top level of the plot.

stat

The statistical transformation to use on the data for this layer, as a string.

position

Position adjustment, either as a string, or the result of a call to a position adjustment function.

show.legend

logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE always includes.

inherit.aes

If FALSE, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g. borders.

...

other arguments passed on to layer. There are three types of arguments you can use here:

  • Aesthetics: to set an aesthetic to a fixed value, like color = "red" or size = 3.

  • Other arguments to the layer, for example you override the default stat associated with the layer.

  • Other arguments passed on to the stat.

Examples

 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
p <- ggplot(mtcars, aes(factor(cyl), mpg))

p + geom_vase()
qplot(factor(cyl), mpg, data = mtcars, geom = "vase")

p + geom_vase() + geom_jitter(height = 0)
p + geom_vase() + coord_flip()
qplot(factor(cyl), mpg, data = mtcars, geom = "vase") +
  coord_flip()

# Scale maximum width proportional to sample size:
p + geom_vase(scale = "count")

# Scale maximum width to 1 for all violins:
p + geom_vase(scale = "width")

# Use a smaller bandwidth for closer density fit (default is 1).
p + geom_vase(adjust = .5)

# Add aesthetic mappings
# Note that vases are automatically dodged when any aesthetic is
# a factor
p + geom_vase(aes(fill = cyl))
p + geom_vase(aes(fill = factor(cyl)))
p + geom_vase(aes(fill = factor(vs)))
p + geom_vase(aes(fill = factor(am)))

# Set aesthetics to fixed value
p + geom_vase(fill = "grey80", colour = "#3366FF")
qplot(factor(cyl), mpg, data = mtcars, geom = "vase",
  colour = I("#3366FF"))

x <- rnorm(2000)
group <- rep(1:20, 100)
y <- rep(c(1,2),1000)
qplot(y,x,facets=~group, fill=factor(y), geom="vase")

heike/ggboxplots documentation built on May 17, 2019, 3:23 p.m.