pairplot
pairplot.Rmd
Default settings
library(pairplot)
penguins_url <- "https://raw.githubusercontent.com/allisonhorst/palmerpenguins/main/inst/extdata/penguins.csv"
columns <- c("bill_length_mm", "bill_depth_mm", "flipper_length_mm", "body_mass_g")
penguins <- read.csv(penguins_url)[columns]
penguins <- penguins[!apply(is.na(penguins), 1, any), ] # dropping NA
pairgrid(
penguins,
map_lower=pair_geom_smooth,
map_diag=pair_geom_histogram,
map_upper=pair_geom_point
)
#> Warning: Ignoring unknown parameters: unit_y
#> Ignoring unknown parameters: unit_y
#> Ignoring unknown parameters: unit_y
#> Ignoring unknown parameters: unit_y
#> Ignoring unknown parameters: unit_y
#> Ignoring unknown parameters: unit_y
Legend text on all plots
pairgrid(
penguins,
map_lower=pair_geom_smooth,
map_diag=pair_geom_histogram,
map_upper=pair_geom_point,
repeat_text=TRUE
)
#> Warning: Ignoring unknown parameters: unit_y
#> Ignoring unknown parameters: unit_y
#> Ignoring unknown parameters: unit_y
#> Ignoring unknown parameters: unit_y
#> Ignoring unknown parameters: unit_y
#> Ignoring unknown parameters: unit_y
Playing with theme
library(patchwork)
library(ggplot2)
pairgrid(
penguins,
map_lower=pair_geom_smooth,
map_diag=pair_geom_histogram,
map_upper=pair_geom_point,
repeat_text=TRUE
) + plot_layout() & theme(plot.margin = margin(
r = 0,
l = 0.5
)
)
#> Warning: Ignoring unknown parameters: unit_y
#> Ignoring unknown parameters: unit_y
#> Ignoring unknown parameters: unit_y
#> Ignoring unknown parameters: unit_y
#> Ignoring unknown parameters: unit_y
#> Ignoring unknown parameters: unit_y