Description Usage Arguments Value Parameters to Geom Examples
This layer function displays the labels of Earthquakes (coming from your label
) by
presenting each label, rotated 45 degrees, as text.
The top nmax
labels, based on the size
column, will be displayed on top of a vertical line.
This vertical line has one end located at the Earthquakes' x-coordinates (dates), and the other end under the label.
If given a y
argument, the vertical lines will be displayed in two groups at each of the y-coordinates; the
top nmax
labels will be displayed for EACH y-coordinate.
1 2 3 |
mapping |
Mapping argument to the ggplot layer function. |
data |
A Dataframe Object containing the data to plot. |
stat |
Stat argument to the ggplot layer function. |
position |
Position argument to the ggplot layer function. |
na.rm |
na.rm argument to the ggplot layer function. |
show.legend |
show.legend argument to the ggplot layer function. |
inherit.aes |
inherit.aes argument to the ggplot layer function. |
... |
Extra Params. |
This function adds the lineGrobs and textGrobs into the current graphics device.
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.