View source: R/ggscatterstats.R
grouped_ggscatterstats | R Documentation |
Grouped scatterplots from {ggplot2}
combined with marginal distribution
plots with statistical details added as a subtitle.
grouped_ggscatterstats(
data,
...,
grouping.var,
plotgrid.args = list(),
annotation.args = list()
)
data |
A data frame (or a tibble) from which variables specified are to
be taken. Other data types (e.g., matrix,table, array, etc.) will not
be accepted. Additionally, grouped data frames from |
... |
Arguments passed on to
|
grouping.var |
A single grouping variable. |
plotgrid.args |
A |
annotation.args |
A |
For details, see: https://indrajeetpatil.github.io/ggstatsplot/articles/web_only/ggscatterstats.html
ggscatterstats
, ggcorrmat
,
grouped_ggcorrmat
# to ensure reproducibility
set.seed(123)
library(dplyr, warn.conflicts = FALSE)
library(ggplot2)
grouped_ggscatterstats(
data = filter(movies_long, genre == "Comedy" | genre == "Drama"),
x = length,
y = rating,
type = "robust",
grouping.var = genre,
ggplot.component = list(geom_rug(sides = "b"))
)
# using labeling
# (also show how to modify basic plot from within function call)
grouped_ggscatterstats(
data = filter(ggplot2::mpg, cyl != 5),
x = displ,
y = hwy,
grouping.var = cyl,
type = "robust",
label.var = manufacturer,
label.expression = hwy > 25 & displ > 2.5,
ggplot.component = scale_y_continuous(sec.axis = dup_axis())
)
# labeling without expression
grouped_ggscatterstats(
data = filter(movies_long, rating == 7, genre %in% c("Drama", "Comedy")),
x = budget,
y = length,
grouping.var = genre,
bf.message = FALSE,
label.var = "title",
annotation.args = list(tag_levels = "a")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.