-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathREADME.Rmd
More file actions
186 lines (123 loc) · 6.1 KB
/
README.Rmd
File metadata and controls
186 lines (123 loc) · 6.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
[](https://doi.org/10.5281/zenodo.14544022) [](https://opensource.org/licenses/MIT) 
# EffectVisR
<img src="man/figures/hex_sticker.png" width="150" />
# Overview
The **EffectVisR** package (pronounced Effect Wizard) provides functions to easily visualise effect sizes and their 95% confidence intervals. It offers two flexible plotting functions, each tailored to highlight confidence intervals in different ways:
- `es_plot_v1`: Highlights confidence intervals with distinct gradient colours.
- `es_plot_v2`: Emphasises the closeness of confidence intervals to the effect size using gradient shading.
Both functions are highly customisable and are ideal for presentations and publications.

### Key Features:
- **Two visualisation methods**:
- `es_plot_v1`: Shades the confidence interval with different colours for the lower and upper bounds.
- `es_plot_v2`: Shades the confidence interval with lighter colours further from the effect size.
<!-- -->
- **Customisable visuals**:
- Multiple colour palettes (`"viridis"`, `"grey"`, `"magma"`, etc.).
- Adjustable axis labels, titles, and arrow styles.
- Option to display the confidence interval as a full fan or partial arc.
- **Export options**: Save plots as high-quality PNG files with transparent backgrounds.
## Installation
To install the latest version of **EffectVisR** from GitHub, use the following commands in R:
`install.packages("remotes")`
`remotes::install_github("FSchwendinger/EffectVisR")`
After installation, load the package using:
```{r load_package, message = FALSE, warning = FALSE, echo = TRUE, eval = F}
library(EffectVisR)
```
## Example Usage
### 1. Visualising effect sizes with `es_plot_v1`
The `es_plot_v1` function creates a plot with a gradient showing confidence intervals around an effect size. It highlights the range of possible effect sizes (95% CI) using colour gradients, with different colours for positive and negative effect sizes.
```{r, message = FALSE, warning = FALSE, echo = TRUE, eval = T, out.width = "50%"}
library(EffectVisR)
# Define the effect size and confidence intervals
effect_size <- 0.4
ci_lower <- 0.1
ci_upper <- 0.7
# Create the plot
EffectVisR::es_plot_v1(
effect_size = effect_size,
ci_lower = ci_lower,
ci_upper = ci_upper,
palette = "viridis",
arrow_color = "black",
axis_title_size = 8,
axis_label_size = 8
)
```
### 2. Visualising effect sizes with `es_plot_v2`
The `es_plot_v2` function generates a plot with shading that highlights the confidence interval range and how close it is to the effect size. Darker colours within the 95% CI show that the values are close to the estimate, while lighter colours are further away.This will produce plots like the following.
```{r, message = FALSE, warning = FALSE, echo = TRUE, eval = T, out.width = "50%"}
# Define effect size and confidence interval
effect_size <- -0.3
ci_lower <- -0.6
ci_upper <- 0
# Create plot 1
a = EffectVisR::es_plot_v2(
effect_size = effect_size,
ci_lower = ci_lower,
ci_upper = ci_upper,
palette = "grey",
arrow_color = "darkred",
axis_title_size = 8,
axis_label_size = 8
)
# Create plot 2
b = EffectVisR::es_plot_v2(
effect_size = effect_size,
ci_lower = ci_lower,
ci_upper = ci_upper,
palette = "magma",
axis_title_size = 8,
axis_label_size = 8,
area_arc = 0.95
)
cowplot::plot_grid(a, b, nrow = 1)
```
## Customisation Options
Both functions (`es_plot_v1` and `es_plot_v2`) allow you to adjust several parameters:
- **effect_size**: Numeric value indicating the estimated effect size.
- **ci_lower, ci_upper**: Lower and upper bounds of the 95% confidence interval.
- **palette**: Choose from `"viridis"`, `"grey"`, or other Viridis-based palettes (e.g., `"magma"`, `"plasma"`, etc.).
- **arrow_color**: Customise the colour of the arrow representing the effect size.
- **area_arc**: Switch between fan and arch to display 95% confidence intervals.
- **save_path**: Option to save the plot as a PNG file (optional).
- **axis_title_size, axis_label_size**: Adjust font sizes for axis titles and labels.
- **limit**: Set the limits of effect sizes displayed in the plot.
### Example: Saving the Plot
You can save your plot with a transparent background using the `save_path` argument.
```{r, message = FALSE, warning = FALSE, echo = TRUE, eval = F}
EffectVisR::es_plot_v1(
effect_size = 0.4,
ci_lower = 0.1,
ci_upper = 0.7,
palette = "viridis",
arrow_color = "black",
save_path = "effect_size_plot.png"
)
```
## License [](https://opensource.org/licenses/MIT)
This package is licensed under the MIT License. You are free to use, share, and modify the work with no restrictions, provided that appropriate credit is given.
See the LICENSE file for more details.
For more information, see the MIT License.
## Citation
This package makes use of ggplot2 (licensed under MIT). See https://ggplot2.tidyverse.org for more details.
If you use this R-package, please cite it as follows:
Schwendinger, F., & Lichtenstein, E. (2024). EffectVisR - Customisable effect size plots with confidence intervals for scientific presentations and publications (v1.0.0). Zenodo. https://doi.org/10.5281/zenodo.14544022
## Contributors
- **Fabian Schwendinger, PhD** *(author, creator)* [](https://www.linkedin.com/in/fabian-schwendinger)
- **Eric Lichtenstein, PhD** *(author)*
- **Denis Infanger, PhD** *(contributor)*
Feel free to contribute or report any issues on the [GitHub](https://github.com/FSchwendinger/EffectVisR) repository.