What geom is used to get sample size 'tick' marks at the bottom of plots?

55 Views Asked by At

I've been using the draw function in the R package gratia to take a preliminary look at model results. This function puts 'tick' marks along the x axis to show where there are samples. What geom in ggplot is used to do this?

df <- data.frame(y = rnorm(100, 10, 1),
                 x = seq(1, 100, 1))
m <- gam(y ~ s(x), data = df)
draw(m)

enter image description here

1

There are 1 best solutions below

0
On BEST ANSWER

As explained by @user2554330, this can be replicated with geom_rug.

Example:

df <- data.frame(y = rnorm(100, 10, 1),
                 x = seq(1, 100, 1))
m <- gam(y ~ s(x), data = df)
draw(m)
ggplot(data = df) +
  geom_smooth(aes(x = x, y = y), method = "gam", formula = y ~ s(x, bs = "tp")) +
  geom_rug(aes(x = x))