-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathREADME.Rmd
75 lines (48 loc) · 2.75 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
---
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%"
)
```
# ggannotate <img src="man/figures/ggannotate_hex.png" align="right" height="138.5"/>
<!-- badges: start -->
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental) [![R build status](https://github.com/mattcowgill/ggannotate/workflows/R-CMD-check/badge.svg)](https://github.com/mattcowgill/ggannotate/actions) [![Codecov test coverage](https://codecov.io/gh/mattcowgill/ggannotate/branch/master/graph/badge.svg)](https://codecov.io/gh/mattcowgill/ggannotate?branch=master) [![CRAN status](https://www.r-pkg.org/badges/version/ggannotate)](https://CRAN.R-project.org/package=ggannotate)
<!-- badges: end -->
{ggannotate} is a point-and-click tool to help you put your annotations exactly where you want them to go on your {ggplot2} plots.
The last step in data visualisation - adding annotations - is one of the most important, but it can be hard to get annotations in exactly the right place. With {ggannotate}, you interactively annotate ggplots using a Shiny-based RStudio add-in.
## Installation
{ggannotate} is not yet on CRAN. It will be submitted to CRAN when it is more stable and feature-complete.
Install from GitHub:
```{r, eval = FALSE}
remotes::install_github("mattcowgill/ggannotate")
```
## Usage
Create a ggplot2 object, then call `ggannotate()`:
```{r, eval = FALSE}
library(ggplot2)
library(ggannotate)
p <- ggplot(mtcars,
aes(x = wt, y = mpg)) +
geom_point()
ggannotate(p)
```
If you invoke `ggannotate()` without specifying a plot, it will use the last plot you modified or created, using `ggplot2::last_plot()`:
```{r, eval = FALSE}
ggplot(mtcars,
aes(x = wt, y = mpg)) +
geom_point()
ggannotate()
```
You can also use the RStudio add-in to annotate your `last_plot()` with `ggannotate()`.
Each of these options will launch a Shiny app. Add your annotation(s) and click 'copy code' to copy the annotation code to the clipboard. Then paste the copied code in your script and you're done!
You can adjust the size of the plot in the Shiny app so you can set it to be the same as your intended output.
## Lifecycle
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
{ggannotate} is still in active development, in an experimental phase. Aspects of the functionality are quite likely to change as the package evolves.
Suggestions are welcome (please file a GitHub issue). The UI will change substantially.