knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) if (!require(devtools)) { install.packages('devtools') } devtools::install_github('jorvlan/openvis') library(openvis)
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) tail(df_1x1)
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
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
figure_1x1_rm <- raincloud_1x1_repmes(df_1x1, line_alpha = .5, line_color = 'gray', alpha = .3, size = 2, 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
figure_1x1_rm_2.0 <- raincloud_1x1_repmes(df_1x1, line_alpha = .9, line_color = 'black', alpha = .8, size = 2, align_clouds = TRUE) + scale_x_continuous(breaks=c(1,2), labels=c("Before", "After"), limits=c(0, 3)) + xlab("States") + ylab("Score") + theme_classic() figure_1x1_rm_2.0
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) tail(df_2x2_1.0)
figure_2x2_1.0 <- raincloud_2x2_repmes(df_2x2_1.0, line_color = 'gray', line_alpha = .5, size = 2, alpha = .5, 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
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) head(df_2x2_2.0) tail(df_2x2_2.0)
figure_2x2_2.0 <- raincloud_2x2_repmes(df_2x2_2.0,line_color = 'gray', line_alpha = .5, size = 2, alpha = .5, 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
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) tail(df_2x3)
figure_2x3_v <- raincloud_2x3_repmes(df_2x3, size = 1, alpha = .5, 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
figure_2x3_h <- raincloud_2x3_repmes(df_2x3, size = 1, alpha = .6, 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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.