Description Usage Arguments Examples
View source: R/f_geom_line_endpoint.R
A geom that draws a point at the intercept of linear model estimate
1 2 3 4 5 6 7 8 9 |
... |
all the geom_point arguments |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | # without the function
library(magrittr)
library(dplyr)
cars %>%
mutate(speed_cat = speed > 8) %>%
group_by(speed_cat) %>%
filter(speed == max(speed)) ->
cars_group_endpoint
library(ggplot2)
ggplot(data = cars) +
aes(x = speed, y = dist) +
aes(color = speed > 8) +
geom_line() +
geom_point(data = cars_group_endpoint)
layer_data(last_plot(), 2)
# the proto
"StatEndpoint"
f_geom_line_endpoint
# the function
f_geom_line_endpoint
# using the function
ggplot(data = cars) +
aes(x = speed, y = dist) +
geom_line() +
f_geom_line_endpoint(size = 4) +
aes(color = speed > 9)
layer_data(last_plot(), 2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.