geom_bump: geom_bump Creates a ggplot that makes a smooth rank over...

Description Usage Arguments Value Examples

View source: R/ggbump.R

Description

geom_bump

Creates a ggplot that makes a smooth rank over time. To change the 'smooth' argument you need to put it outside of the 'aes' of the geom. Uses the x and y aestethics.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
geom_bump(
  mapping = NULL,
  data = NULL,
  geom = "line",
  position = "identity",
  na.rm = FALSE,
  show.legend = NA,
  smooth = 8,
  direction = "x",
  inherit.aes = TRUE,
  ...
)

Arguments

mapping

provide you own mapping. both x and y need to be numeric.

data

provide you own data

geom

change geom

position

change position

na.rm

remove missing values

show.legend

show legend in plot

smooth

how much smooth should the curve have? More means steeper curve.

direction

the character x or y depending of smoothing direction

inherit.aes

should the geom inherits aestethics

...

other arguments to be passed to the geom

Value

ggplot layer

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
library(ggplot2)
df <- data.frame(country = c(
  "India", "India", "India",
  "Sweden", "Sweden", "Sweden",
  "Germany", "Germany", "Germany",
  "Finland", "Finland", "Finland"),
year = c(2011, 2012, 2013,
2011, 2012, 2013,
2011, 2012, 2013,
2011, 2012, 2013),
rank = c(4, 2, 2, 3, 1, 4, 2, 3, 1, 1, 4, 3))

ggplot(df, aes(year, rank, color = country)) +
  geom_point(size = 10) +
  geom_bump(size = 2)

ggbump documentation built on April 24, 2020, 5:05 p.m.