Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(tidyverse)
- library(here)
- library(ggsci)
- df.alpha <- read_csv("online.csv")
- ggplot(df.alpha, aes(Margin)) +
- geom_density(aes(fill=Side), alpha=0.5) +
- scale_fill_npg()
- tmp <- df.alpha %>% unite("id", c("Order", "Name"), sep = ".") %>% arrange(-Margin)
- tmp$id <- factor(tmp$id, levels=tmp$id)
- ggplot(tmp, aes(y=Margin)) +
- geom_bar(aes(x=id, fill=Side), stat="identity") +
- coord_flip() + scale_fill_npg()
- tmp <- df.alpha %>% unite("id", c("Order", "Name"), sep = ".") %>% arrange(Order)
- tmp$id <- factor(tmp$id, levels=tmp$id)
- tmp %>% ggplot(aes(y=Margin)) +
- geom_bar(aes(x=id, fill=Side), stat="identity") +
- coord_flip() + scale_fill_npg() + scale_y_reverse()
Add Comment
Please, Sign In to add comment