theme_ggstatsplot
ggstatsplot
uses a default theme theme_ggstatsplot()
, which is a selected ggplot2
theme with few aesthetic modifications overlaid on top, that can be used with any ggplot2
object. Alternative name for this function is theme_mprl
.
Here is a simple example:
library(ggplot2)
# Basic scatter plot
ggplot2::ggplot(
data = datasets::mtcars,
mapping = ggplot2::aes(x = wt, y = mpg)
) +
ggplot2::geom_point() +
ggplot2::theme_bw()
# Basic scatter plot with theme_ggstatsplot() added
ggplot2::ggplot(
data = datasets::mtcars,
mapping = ggplot2::aes(x = wt, y = mpg)
) +
ggplot2::geom_point() +
ggstatsplot::theme_ggstatsplot(ggtheme = ggplot2::theme_bw())
All plots in this package have theme_bw()
by default as the base on which theme_ggstatsplot()
is built, but this can be modified using the ggtheme
argument provided for all functions. For example, for the ggbetweenstats
function the default theme can be changed to, for example, theme_grey()
:
ggstatsplot::ggbetweenstats(
data = datasets::iris,
x = Species,
y = Sepal.Length,
ggtheme = ggplot2::theme_grey() # selected ggplot2 theme
)
#> Reference: Welch's ANOVA is used as a default. (Delacre, Leys, Mora, & Lakens, PsyArXiv, 2018).Note: Shapiro-Wilk Normality Test for Sepal.Length : p-value = 0.010Note: Bartlett's test for homogeneity of variances for factor Species : p-value = < 0.001
Another example with ggscatterstats
:
ggstatsplot::ggscatterstats(
data = datasets::iris,
x = Sepal.Width,
y = Sepal.Length,
ggtheme = ggplot2::theme_dark() # selected ggplot2 theme
)
#> Warning: This function doesn't return a `ggplot2` object and is not further modifiable with `ggplot2` functions.
The only exception for how ggtheme
argument is to be entered is ggcorrmat
function where the theme should not be entered as a function.
ggstatsplot::ggcorrmat(
data = datasets::iris,
cor.vars = c(Sepal.Length:Petal.Width),
type = "upper",
ggtheme = ggplot2::theme_dark # selected ggplot2 theme
)
If you find any bugs or have any suggestions/remarks, please file an issue on GitHub: https://github.com/IndrajeetPatil/ggstatsplot/issues