Description Usage Arguments Aesthetics Author(s) See Also Examples
The function will return a graph of the intensity of the selected
metric along the *y*-axis versus a time variable along the *x*-axis.
The number of top events (n
) from the chosen metric may be highlighted
in a brighter colour with the aesthetic value colour.n
.
This function differs in use from lolli_plot
in that it must be created as a ggplot2 'geom' object. The benefit of this being
that one may add additional information layer by layer to the figure as
geoms as necessary.
1 2 |
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If NULL, the default, the data is inherited from the plot data as specified
in the call to A data.frame, or other object, will override the plot data. All objects will
be fortified to produce a data frame. See A function will be called with a single argument, the plot data. The return
value must be a |
... |
other arguments passed on to |
n |
The number of top events to highlight. Default is 1. This parameter
has no effect if |
na.rm |
If |
show.legend |
Logical. Should this layer be included in the legends? |
inherit.aes |
If |
geom_lolli
understands the following aesthetics (required aesthetics
are in bold):
x
y
alpha
color
linetype
size
shape
stroke
fill
colour.n
: While this value may be used as an aesthetic, it also
works as a parameter for this function. If one chooses not to highlight
any events, use colour.n = NA
outside of aes()
. One may
also provide a non-static value to colour.na
but remember that
one may not provide multiple continuous or discrete scales to a single
ggplot2 object. Therefore, if one provides a continuous value to
aes(colour)
, the values supplied to colour.n
must be
discrete. ggplot2 will attempt to do this automatically.
Robert W. Schlegel
lolli_plot
for a non-geom based lolliplot function.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ts_dat <- make_whole(sst_NW_Atl)
# with defaults:
res <- detect(ts_dat, climatology_start = "1983-01-01",
climatology_end = "2012-12-31")
mhw <- res$event
## Not run:
require(lubridate)
# Height of lollis represent event durations and their colours
# are mapped to the events' cumulative intensity:
ggplot(mhw, aes(x = mhw$date_peak, y = mhw$duration)) +
geom_lolli(n = 0, shape = 20, aes(colour = mhw$int_cum), colour.n = NA) +
scale_color_distiller(palette = "Spectral", name = "Cumulative \nintensity") +
xlab("Date") + ylab("Event duration [days]")
# Height of lollis represent event durations and the top three (longest)
# lollis are highlighted in red:
ggplot(mhw, aes(x = mhw$date_peak, y = mhw$duration)) +
geom_lolli(n = 3, shape = 20, colour.n = "red") +
scale_color_distiller(palette = "Spectral", name = "Cumulative \nintensity") +
xlab("Date") + ylab("Event duration [days]")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.