Created
November 1, 2016 14:41
-
-
Save aammd/7631d8c5e4ba722b64f030dcc6d2bbec to your computer and use it in GitHub Desktop.
annotating with rectangles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
library(ggplot2) | |
dat <- data_frame(xs = runif(10, 2, 15), | |
ys = runif(10, 2, 15), | |
xe = rnorm(10, 2, 0.4), | |
ye = rnorm(10, 2, 0.4)) | |
dat %>% | |
ggplot(aes(x = xs, y = ys)) + | |
geom_point() + | |
annotate("polygon", | |
xmin = dat$xs - dat$xe, | |
xmax = dat$xs + dat$xe, | |
ymin = dat$ys - dat$ye, | |
ymax = dat$ys + dat$ye) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment