Description Usage Format Value Parameters Examples
This Geom returns a ggproto object made of a gList of lineGrobs and textGrobs. Each lineGrob is a vertical line located
at the points' x-axis. The height of the lines depends on how many y-degrees are given.
The Text grobs writes the text found on the label
argument. There will be one label per row, although the rows are filtered
for only the top nmax
labels, based on their size
column. The text is rotated 45 degrees, and it's positioned slightly
above the top end of the lineGrob.
The Geom allows you to label the higher-valued (based on size
) points in your dataset.
1 |
An object of class GeomTimelineLabel
(inherits from Geom
, ggproto
) of length 6.
This function return a Geom* object containing the line and text Grobs responsible for rendering the images into the plot.
data
: A Dataframe Object containing the data to plot.
x
: Column of 'data' depicting the x-coordinate of where each of the labels will be located.
label
: Column of 'data' depicting the text labels that will be displayed.
size
: Column of 'data' depicting size of the Earthquake, which will be used to decide the top nmax
labels displayed.
y
: OPTIONAL. Column of 'data' depicting the y-coordinate of each label displayed.
nmax
: OPTIONAL. Column of 'data' depicting how many top size
d labels will be displayed.
alpha
: OPTIONAL. Alpha numeric value (0 to 1, added outside of aes) which will be used to apply the alpha to the vertical line.
colour
: OPTIONAL. Color 'string' (added outside of aes) to modify the default color of the lines.
stroke
: OPTIONAL. Stroke of the image (need not be used).
*Note: All of the optional arguments above can be applied as columns of the dataset (inside the function aes), or as individual values (outside of the function aes).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ## Not run:
## Data Setup
dataset = readr::read_delim("data/signif.txt", delim = "\t") %>%
eq_clean_data() %>%
filter(COUNTRY %in% c("USA", "CHINA"), YEAR > 2000)
## Function Call
ggplot2::ggplot(dataset, ggplot2::aes(DATE,
colour = TOTAL_DEATHS,
y = COUNTRY,
size = as.numeric(EQ_PRIMARY) )) +
geom_timeline() +
geom_timeline_label(ggplot2::aes(label = dataset$LOCATION_NAME)) +
ggplot2::guides(size = ggplot2::guide_legend(title = "Ritcher scale value")) +
ggplot2::scale_colour_continuous(name = "# of DEATHS") +
ggplot2::theme_classic()
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.