RainCloud plot is arising as a very informative method to present raw data, basically, it combines boxplot , volin plot , and scatter plot together, in a visually pleasure way.
The RainClould plot requires some basic packages like ggplot2, so we need to load them first.
## load packages
Then we set up the working directory and load the test data
## set work directory and load the data
A very important function used in raincloud plot is geom_flat_volin, which is not a standard function in ggplot2, therefore we need to define it beforehand.
The following function definition is extracted from the this web page: https://gist.github.com/dgrtwo/eb7750e74997891d7c202. Copy and paste them into your code.
Or, you can just source this function via the following code if you won’t bother to copy the complex code. Either way is fine:
geom_flat_volin function definition:
# =========================== function definition ===========================
Everything we need is ready, so let’s do the plot!
First we make a data frame as what usually used in ggplot2.
## make data frame
Then is the plot.
ggplot(data = df, aes(y = rt, x = condition, fill = condition)) +
We then will see the figure.