-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathREADME.Rmd
178 lines (146 loc) · 4.84 KB
/
README.Rmd
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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
results = FALSE,
message = FALSE,
warning = FALSE,
fig.align = "center",
dpi = 300,
fig.width = 5,
fig.height = 2.5,
fig.path = "man/figures/README-"
)
```
# tidyplots <a href="https://jbengler.github.io/tidyplots/"><img src="man/figures/logo.svg" align="right" height="139" alt="tidyplots website" /></a>
<!-- badges: start -->
[![R-CMD-check](https://github.com/jbengler/tidyplots/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/jbengler/tidyplots/actions/workflows/R-CMD-check.yaml)
[![CRAN status](https://www.r-pkg.org/badges/version/tidyplots)](https://CRAN.R-project.org/package=tidyplots)
<!-- badges: end -->
The goal of `tidyplots` is to streamline the creation of publication-ready plots for scientific papers. It allows to gradually add, remove and adjust plot components using a consistent and intuitive syntax.
## Installation
You can install the released version of tidyplots from [CRAN](https://cran.r-project.org/) with:
``` r
install.packages("tidyplots")
```
And the development version from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("jbengler/tidyplots")
```
## Usage
Here are some examples. Also have a look at the [getting started guide](https://jbengler.github.io/tidyplots/articles/tidyplots.html) and the [full documentation](https://jbengler.github.io/tidyplots/reference/).
```{r}
library(tidyplots)
study %>%
tidyplot(x = treatment, y = score, color = treatment) %>%
add_mean_bar(alpha = 0.4) %>%
add_sem_errorbar() %>%
add_data_points_beeswarm()
```
```{r}
energy %>%
tidyplot(x = year, y = energy, color = energy_source) %>%
add_barstack_absolute()
```
```{r}
energy %>%
dplyr::filter(year %in% c(2005, 2010, 2015, 2020)) %>%
tidyplot(y = energy, color = energy_source) %>%
add_donut() %>%
split_plot(by = year)
```
```{r}
energy_week %>%
tidyplot(x = date, y = power, color = energy_source) %>%
add_areastack_absolute()
```
```{r}
energy_week %>%
tidyplot(x = date, y = power, color = energy_source) %>%
add_areastack_relative()
```
```{r}
study %>%
tidyplot(x = group, y = score, color = dose) %>%
add_mean_bar(alpha = 0.4) %>%
add_mean_dash() %>%
add_mean_value()
```
```{r}
time_course %>%
tidyplot(x = day, y = score, color = treatment) %>%
add_mean_line() %>%
add_mean_dot() %>%
add_sem_ribbon()
```
```{r}
climate %>%
tidyplot(x = month, y = year, color = max_temperature) %>%
add_heatmap()
```
```{r, fig.height=3}
study %>%
tidyplot(x = treatment, y = score, color = treatment) %>%
add_boxplot() %>%
add_test_pvalue(ref.group = 1)
```
```{r, fig.height=3.2}
gene_expression %>%
dplyr::filter(external_gene_name %in% c("Apol6", "Col5a3", "Vgf", "Bsn")) %>%
tidyplot(x = condition, y = expression, color = sample_type) %>%
add_mean_dash() %>%
add_sem_errorbar() %>%
add_data_points_beeswarm() %>%
add_test_asterisks(hide_info = TRUE) %>%
remove_x_axis_title() %>%
split_plot(by = external_gene_name)
```
```{r}
study %>%
tidyplot(x = treatment, y = score, color = treatment) %>%
add_mean_bar(alpha = 0.4) %>%
add_sem_errorbar() %>%
add_data_points_beeswarm() %>%
view_plot(title = "Default color scheme: 'friendly'") %>%
adjust_colors(colors_discrete_apple) %>%
view_plot(title = "Alternative color scheme: 'apple'")
```
## Documentation
- [Package index](https://jbengler.github.io/tidyplots/reference/)
Overview of all tidyplots functions
- [Get started](https://jbengler.github.io/tidyplots/articles/tidyplots.html)
Getting started guide
- [Visualizing data](https://jbengler.github.io/tidyplots/articles/Visualizing-data.html)
Article with examples for common data visualizations
- [Advanced plotting](https://jbengler.github.io/tidyplots/articles/Advanced-plotting.html)
Article about advanced plotting techniques and workflows
- [Color schemes](https://jbengler.github.io/tidyplots/articles/Color-schemes.html)
Article about the use of color schemes
## Acknowledgements
I would like to thank Lars Binkle-Ladisch for our insightful discussions and for consistently challenging my decisions regarding the naming of functions and their arguments.
Many thanks to the R and tidyverse communities. tidyplots is built upon their software and coding paradigms, and it would not have been possible without their contributions.
tidyplots relies on several fantastic packages that handle all the heavy lifting behind the scenes. These include
cli,
dplyr,
forcats,
ggbeeswarm,
ggplot2,
ggpubr,
ggrastr,
ggrepel,
glue,
Hmisc,
htmltools,
lifecycle,
patchwork,
purrr,
rlang,
scales,
stringr,
tidyr, and
tidyselect.