r_geom_lm_sample: A geom that shows a sampling of points

Description Usage Arguments Examples

View source: R/r_geom_lm_sample.R

Description

A geom that shows a sampling of points

Usage

1
2
3
4
5
6
7
8
9
r_geom_lm_sample(
  mapping = NULL,
  data = NULL,
  position = "identity",
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = TRUE,
  ...
)

Arguments

...

all the geom_point arguments

Examples

 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)
set.seed(1214)
cars %>%
 slice_sample( n = 10) ->
 cars_sample


library(ggplot2)
ggplot(data = cars) +
 aes(x = speed, y = dist) +
 geom_point() +
 geom_point(data = cars_sample,
            color = "magenta") +
 geom_smooth(method = lm, se = F,
             data = cars_sample)

# the proto and function
"StatSamplepoint"
r_geom_lm_sample

# using the function

my_seed <- sample(1:100, 1)
ggplot(data = cars) +
 aes(x = speed, y = dist) +
 geom_point() +
 geom_smooth(method = lm, se = F) +
 q_geom_point_sample(color = "red", seed = my_seed) +
 r_geom_lm_sample(color = "red", seed = my_seed)

EvaMaeRey/ggextend documentation built on Dec. 17, 2021, 7:24 p.m.