Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(tidyverse)
- library(magrittr)
- library(purrr)
- library(forcats)
- base <- expand.grid(chem = c("Th", "Ta", "Nb", "La", "Ce", "P", "Zr", "Hf", "Sm", "Ti", "Y", "Yb", "Lu"),
- id=1:7)
- grouping <- data.frame(id=1:7,
- trend=rep(c("WNW", "NE"),
- times=c(2,5)))
- dat <- inner_join(base, grouping)
- dat %<>%
- split( list(.$chem, .$trend)) %>%
- map(~mutate(.x, mean = rlnorm(n=1))) %>%
- map(~mutate(.x,
- y = rlnorm(n=nrow(.x),
- meanlog = .$mean,
- sdlog = 0.1))) %>%
- bind_rows %>%
- mutate(chem = fct_inorder(chem)) %>%
- arrange(chem, id)
- ggplot(data=dat, aes(x=chem, y=y)) +
- geom_line(aes(group=id, lty=trend)) +
- scale_y_log10() +
- theme_bw() +
- annotation_logticks(sides="lr")
Add Comment
Please, Sign In to add comment