Skip to content
🎨 Visualisation toolbox for beautiful and publication-ready figures
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R fix issue with equivalence-test due to renaming (upper case) of values Jun 24, 2019
docs restructure website Jun 20, 2019
man add rope-region Jun 23, 2019
pkgdown/favicon
revdep revdep Jun 19, 2019
.Rbuildignore add revdep-checks Jun 19, 2019
.gitignore Initial commit Apr 9, 2019
.travis.yml win not supported? May 12, 2019
DESCRIPTION
LICENSE Initial commit Apr 9, 2019
NAMESPACE Added plot-function for `performance::check_homogeneity()` Jun 19, 2019
NEWS.md restructure website Jun 20, 2019
README.Rmd geom_poolpoint Jun 5, 2019
README.md geom_poolpoint Jun 5, 2019
_pkgdown.yml restructure website Jun 20, 2019
see.Rproj logo Apr 9, 2019

README.md

see

CRAN downloads Build Status codecov Documentation

“Damned are those who believe without seeing”

Installation

Run the following:

install.packages("devtools")
devtools::install_github("easystats/see")
library("see")

Features

Themes

  • Modern
library(ggplot2)

ggplot(iris, aes(x = Sepal.Width, y = Sepal.Length, color = Species)) +
  geom_point2() +
  theme_modern()

  • Lucid
library(ggplot2)

ggplot(iris, aes(x = Sepal.Width, y = Sepal.Length, color = Species)) +
  geom_point2() +
  theme_lucid()

  • Blackboard
library(rstanarm)
library(estimate)

dat <- rstanarm::stan_glm(Sepal.Width ~ poly(Petal.Length, 2), data = iris) %>% 
  estimate::estimate_fit(keep_draws = TRUE, length = 100, draws = 250) %>% 
  estimate::reshape_draws()

p <- ggplot(dat, aes(x = Petal.Length, y = Draw, group = Draw_Index)) +
  geom_line(color = "white", alpha = 0.05) +
  scale_x_continuous(expand = c(0, 0)) +
  scale_y_continuous(expand = c(0, 0))

p + theme_blackboard() 

  • Abyss

Palettes

  • Material design
p1 <- ggplot(iris, aes(x = Species, y = Sepal.Length, fill = Species)) +
  geom_boxplot() +
  theme_modern(axis.text.angle = 45) +
  scale_fill_material_d()

p2 <- ggplot(iris, aes(x = Species, y = Sepal.Length, fill = Species)) +
  geom_violin() +
  theme_modern(axis.text.angle = 45) +
  scale_fill_material_d(palette = "ice")

p3 <- ggplot(iris, aes(x = Petal.Length, y = Petal.Width, color = Sepal.Length)) +
  geom_point2() +
  theme_modern() +
  scale_color_material_c(palette = "rainbow")

The plots() function allows us to plot the figures side by side.

plots(p1, p2, p3, ncol = 2)

Multiple plots

The plots() function can also be used to add tags (i.e., labels for subfigures).

plots(p1, p2, p3, ncol = 2, 
      tags = paste("Fig. ", 1:3))

Better looking points

geom_points2() and geom_jitter2() allow points without borders and contour.

normal <- ggplot(iris, aes(x = Petal.Width, y = Sepal.Length)) +
  geom_point(size = 8, alpha = 0.3) +
  theme_modern()

new <- ggplot(iris, aes(x = Petal.Width, y = Sepal.Length)) +
  geom_point2(size = 8, alpha = 0.3) +
  theme_modern()

plots(normal, new, ncol = 2)

Half-violin Half-dot plot

Create a half-violin half-dot plot, useful for visualising the distribution and the sample size at the same time.

ggplot(iris, aes(x = Species, y = Sepal.Length, fill = Species)) +
  geom_violindot(fill_dots = "black") +
  theme_modern() +
  scale_fill_material_d()

Pool ball points

ggplot(iris, aes(x = Sepal.Width, y = Sepal.Length, color = Species)) +
  geom_pooljitter(label = row.names(iris)) +
  scale_color_flat_d() +
  theme_modern()

BayestestR

Density Estimation

library(bayestestR)
library(rstanarm)

model <- rstanarm::stan_glm(Sepal.Length ~ Petal.Width * Species, data = iris)

result <- estimate_density(model)

plot(result)

plot(result, stack=FALSE)

Probability of Direction (pd)

result <- p_direction(model)

plot(result) +
  theme_modern() +
  scale_fill_manual(values = c("red", "green"))

Most of our plots can be easily opened via the how_to_plot function. This gives us the actual code used for plotting, that can then be easily extracted and tweaked to your needs.

how_to_plot(result)
## # Assuming that the input object is `x`:
## 
## data_plot(x) %>%
##   as.data.frame() %>%
##   ggplot(aes(x = x, y = y, height = height, group = y, fill = fill)) +
##   ggridges::geom_ridgeline_gradient() +
##   add_plot_attributes(x) +
##   geom_vline(aes(xintercept = 0))

Highest Density Interval (HDI)

library(rstanarm)

model <- rstanarm::stan_glm(Sepal.Length ~ Petal.Width * Species, data = iris)
result <- hdi(model, ci = c(0.5, 0.75, 0.89, 0.95))

plot(result) +
  theme_modern() +
  scale_fill_brewer(palette = "Purples", direction = -1)

Region of Practical Equivalence (ROPE)

result <- rope(model, ci = c(0.9, 0.95))

plot(result, data = model, rope_color = "red") +
  theme_modern() +
  scale_fill_brewer(palette = "Greens", direction = -1)

Test for Practical Equivalence

model <- rstanarm::stan_glm(
  mpg ~ wt + gear + cyl + disp, data = mtcars
)
result <- equivalence_test(model)

plot(result) +
  theme_blackboard() +
  scale_fill_material()

result <- equivalence_test(model, ci = c(.89, .95))
plot(result) +
    theme_abyss() +
    scale_fill_flat()

Bayes Factors (BFs)

result <- bayesfactor_savagedickey(model)

plot(result) +
  theme_modern() +
  scale_color_material() +
  scale_fill_material()

lm0 <- lm(qsec ~ 1, data = mtcars)
lm1 <- lm(qsec ~ drat, data = mtcars)
lm2 <- lm(qsec ~ wt, data = mtcars)
lm3 <- lm(qsec ~ drat + wt, data = mtcars)

result <- bayesfactor_models(lm1, lm2, lm3, denominator = lm0)

plot(result, n_pies = "one", value = "probability") +
  scale_fill_pizza(reverse = TRUE) 

plot(result, n_pies = "many", value = "BF") +
  scale_fill_flat(palette = "rainbow", reverse = TRUE)

estimate

Pairwise Contrasts

library(rstanarm)
library(estimate)

model <- stan_glm(Sepal.Width ~ Species, data = iris) +
  theme_modern()

contrasts <- estimate_contrasts(model)
means <- estimate_means(model)

plot(contrasts, means)

You can’t perform that action at this time.