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)
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))