Skip to content

Instantly share code, notes, and snippets.

View EhsanKhedive's full-sized avatar

Ehsan Khedive EhsanKhedive

View GitHub Profile
@EhsanKhedive
EhsanKhedive / multi_smooth_ggpairs.R
Created April 18, 2024 23:16 — forked from padamson/multi_smooth_ggpairs.R
Add two regression lines to plots in ggpairs
require(datasets)
data("swiss")
require(GGally)
require(ggplot2)
my_fn <- function(data, mapping, ...){
p <- ggplot(data = data, mapping = mapping) +
geom_point() +
geom_smooth(method=loess, fill="red", color="red", ...) +
geom_smooth(method=lm, fill="blue", color="blue", ...)