geom_timelabel: Corresponding function to GeomTimelinelabel

Description Usage Details Value Examples

Description

The function is used with ggplot2 to produce annotation for the earthquake data. For input arguments, please refer to geom_point for further details. An optional argument n_max can be specified to indicate how many points should be annotated. Another aes byCol can be specified to indicate how the n_max rows be selected. If byCol is specified, the highest n_max rows according to byCol will be selected. if no byCol is specified, n_max rows will be selected randomly.

Usage

1
2
3
4
geom_timelabel(mapping = NULL, data = NULL, stat = "timelabel",
  position = "identity", ..., parse = FALSE, nudge_x = 0, nudge_y = 0,
  check_overlap = FALSE, na.rm = FALSE, show.legend = FALSE,
  inherit.aes = TRUE)

Details

Note that for meaningful outcome, it is expected this function is accompanied with geom_timeline when plotting. Otherwise, there will only be annotations with no reference to the point and axis. In light of that, both geoms should be "given the same data", i.e. aes mapping shoud be done for xmin and xmax if they are required. Refer to example / vigenette.

Value

layer annotation object for plotting purpose

Examples

1
2
3
4
5
6
7
## Not run: ggplot(data = selected) + aes(x=DATE, y=COUNTRY, colour =
  TOTAL_DEATHS, size = EQ_PRIMARY, label=LOCATION_NAME, byCol=EQ_PRIMARY,
  xmin = xmin, xmax = xmax) + geom_timeline() + geom_timelabel(n_max=5) +
  theme_timeline() + scale_size_continuous(name = "Richter scale value") +
  #change legend name scale_colour_continuous(name = "# Deaths") +
  scale_x_date(limits = c(xmin-months(6), xmax+months(6))) #extend the axis
## End(Not run)

wingtham/NOAA documentation built on May 24, 2019, 3:51 p.m.