README.md

This repository has moved to a different location, please see:

https://github.com/jorvlan/raincloudplots

Raincloud example

This repository serves as the R package for the revisited version of: Raincloud plots: a multi-platform tool for robust data visualization (to be published).

An example figure

Raincloud example

Package demonstration

Installation

if (!require(devtools)) {
    install.packages('devtools')
}
devtools::install_github('jorvlan/openvis')
library("openvis")

Raincloud 1 x 1 comparison

Step 1: Initialize the data-format

df_1x1 <- data_1x1(
  array_1 = iris$Sepal.Length[1:50],
  array_2 = iris$Sepal.Length[51:100],
  jit_distance = .09,
  jit_seed = 321)
> head(df_1x1)
  y_axis x_axis id       jit
1    5.1      1  1 1.0820609
2    4.9      1  2 1.0787114
3    4.7      1  3 0.9528797
4    4.6      1  4 0.9559133
5    5.0      1  5 0.9802922
6    5.4      1  6 0.9714124
> tail(df_1x1)
    y_axis x_axis id      jit
95     5.6      2 45 2.059387
96     5.7      2 46 2.004848
97     5.7      2 47 2.066980
98     6.2      2 48 2.074479
99     5.1      2 49 1.939248
100    5.7      2 50 1.999004

Step 2: Create a vertical or horizontal 1 x 1 Raincloud

figure_1x1_v <- raincloud_1x1(df_1x1, ort = 'v') +

  scale_x_continuous(breaks=c(1,2), labels=c("Group1", "Group2"), limits=c(0, 3)) +
  xlab("Groups") + 
  ylab("Score") +
  theme_classic()

figure_1x1_v

Raincloud example

figure_1x1_h <- raincloud_1x1(df_1x1, ort = 'h') +

  scale_x_continuous(breaks=c(1,2), labels=c("Group1", "Group2"), limits=c(0, 3)) +
  xlab("Groups") + 
  ylab("Score") +
  theme_classic()

figure_1x1_h

Raincloud example

Raincloud repeated measures

figure_1x1_rm <- raincloud_1x1_repmes(df_1x1, align_clouds = FALSE) +

  scale_x_continuous(breaks=c(1,2), labels=c("Before", "After"), limits=c(0, 3)) +
  xlab("States") + 
  ylab("Score") +
  theme_classic()

figure_1x1_rm

Raincloud example

figure_1x1_rm_2.0 <- raincloud_1x1_repmes(df_1x1, align_clouds = TRUE) +

  scale_x_continuous(breaks=c(1,2), labels=c("Before", "After"), limits=c(0, 3)) +
  xlab("States") + 
  ylab("Value") +
  theme_classic()

figure_1x1_rm_2.0

Raincloud example

Raincloud 2 x 2 repeated measures

Step 1: Initialize the data-format

df_2x2_1.0 <- data_2x2(
  array_1 = iris$Sepal.Length[1:50],
  array_2 = iris$Sepal.Length[51:100],
  array_3 = iris$Sepal.Length[101:150],
  array_4 = iris$Sepal.Length[81:130],
  label_1 = 'congruent',
  label_2 = 'incongruent',
  jit_distance = .05,
  jit_seed = 321,
  spread_x_ticks = TRUE) # FALSE if 2 x-ticks
> head(df_2x2_1.0)
  y_axis x_axis id     group       jit
1    5.1      1  1 congruent 1.0455894
2    4.9      1  2 congruent 1.0437286
3    4.7      1  3 congruent 0.9738220
4    4.6      1  4 congruent 0.9755074
5    5.0      1  5 congruent 0.9890512
6    5.4      1  6 congruent 0.9841180
> tail(df_2x2_1.0)
    y_axis x_axis id       group      jit
195    6.7      4 45 incongruent 4.025752
196    7.2      4 46 incongruent 3.980672
197    6.2      4 47 incongruent 4.000718
198    6.1      4 48 incongruent 4.001973
199    6.4      4 49 incongruent 3.972786
200    7.2      4 50 incongruent 4.042541

Step 2: Create a raincloud plot with 4 x-ticks or with 2 x-ticks

figure_2x2_1.0 <- raincloud_2x2_repmes(df_2x2_1.0, spread_x_ticks = TRUE) +

  scale_x_continuous(breaks=c(1,2,3,4),
                     labels=c("low-congr", "high-congr", "low-incongr", "high-incongr"),
                     limits=c(0, 5)) +
  xlab("Conditions") +
  ylab("Score") +
  theme_classic()

figure_2x2_1.0

Raincloud example

df_2x2_2.0 <- data_2x2(
  array_1 = iris$Sepal.Length[1:50],
  array_2 = iris$Sepal.Length[51:100],
  array_3 = iris$Sepal.Length[101:150],
  array_4 = iris$Sepal.Length[81:130],
  label_1 = 'congruent',
  label_2 = 'incongruent',
  jit_distance = .05,
  jit_seed = 321,
  spread_x_ticks = FALSE)
 ```
```r
> head(df_2x2_2.0)
  y_axis x_axis id     group       jit
1    5.1      1  1 congruent 1.0455894
2    4.9      1  2 congruent 1.0437286
3    4.7      1  3 congruent 0.9738220
4    4.6      1  4 congruent 0.9755074
5    5.0      1  5 congruent 0.9890512
6    5.4      1  6 congruent 0.9841180
> tail(df_2x2_2.0)
    y_axis x_axis id       group      jit
195    6.7   2.01 45 incongruent 2.035752
196    7.2   2.01 46 incongruent 1.990672
197    6.2   2.01 47 incongruent 2.010718
198    6.1   2.01 48 incongruent 2.011973
199    6.4   2.01 49 incongruent 1.982786
200    7.2   2.01 50 incongruent 2.052541
figure_2x2_2.0 <- raincloud_2x2_repmes(df_2x2_2.0, spread_x_ticks = FALSE) +

  scale_x_continuous(breaks=c(1,2), labels=c("Before", "After"), limits=c(0, 3)) +
  xlab("States") +
  ylab("Score") +
  theme_classic()

figure_2x2_2.0

Raincloud example

Raincloud 2 x 3 (repeated measures)

Step 1: Initialize the data-format

df_2x3 <- data_2x2(
  array_1 = iris$Sepal.Length[1:50],
  array_2 = iris$Sepal.Length[51:100],
  array_3 = iris$Sepal.Length[101:150],
  array_4 = iris$Sepal.Length[81:130],
  array_5 = iris$Sepal.Length[21:70],
  array_6 = iris$Sepal.Length[41:90],
  label_1 = 'Drug',
  label_2 = 'Placebo',
  jit_distance = .07,
  jit_seed = 321)
> head(df_2x3)
  y_axis x_axis id group       jit
1    5.1      1  1  Drug 1.0638251
2    4.9      1  2  Drug 1.0612200
3    4.7      1  3  Drug 0.9633509
4    4.6      1  4  Drug 0.9657103
5    5.0      1  5  Drug 0.9846717
6    5.4      1  6  Drug 0.9777652
> tail(df_2x3)
    y_axis x_axis id   group      jit
295    5.4   3.01 45 Placebo 3.073854
296    6.0   3.01 46 Placebo 3.062774
297    6.7   3.01 47 Placebo 3.077949
298    6.3   3.01 48 Placebo 3.003069
299    5.6   3.01 49 Placebo 2.965916
300    5.5   3.01 50 Placebo 2.950490

Step 2: Create a vertical or horizontal 2 x 3 Raincloud

figure_2x3_v <- raincloud_2x3_repmes(df_2x3, ort = 'v') +

  scale_x_continuous(breaks=c(1,2,3),
                     labels=c("Time-1", "Time-2", "Time-3"),
                     limits=c(0, 4)) +
  xlab("States") +
  ylab("Score") +
  theme_classic()

figure_2x3_v

Raincloud example

figure_2x3_h <- raincloud_2x3_repmes(df_2x3, ort = 'h') +

  scale_x_continuous(breaks=c(1,2,3),
                     labels=c("1", "2", "3"),
                     limits=c(0, 4)) +
  xlab("States") +
  ylab("Score") +
  theme_classic()

figure_2x3_h

Raincloud example

To-do package

To-do GitHub

To-do paper



jorvlan/openvis documentation built on Dec. 6, 2020, 3:06 a.m.