Skip to content

Instantly share code, notes, and snippets.

@gtgrthrst
Created June 14, 2021 08:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gtgrthrst/e8f26abe80add5ab140d5aceb19ab312 to your computer and use it in GitHub Desktop.
Save gtgrthrst/e8f26abe80add5ab140d5aceb19ab312 to your computer and use it in GitHub Desktop.
year <- rep(1990:2015, times = 4)
type <- rep(c('A','B','C','D'),each = 26)
value <- c(runif(26),runif(26, min = 1,max = 1.5),
runif(26, min = 1.5,max = 2),
runif(26, min = 2,max = 2.5))
df <- data.frame(year = year, type = type, value = value)
ggplot(data = df, mapping = aes(x = year, y = value, fill = type)) +
geom_area(position = 'fill', alpha = 0.8) +
guides(fill = guide_legend(reverse = TRUE)) +
theme(axis.title=element_blank(),
axis.text=element_blank(),
axis.ticks=element_blank())+
guides(fill = FALSE, color = FALSE, linetype = FALSE, shape = FALSE, size = FALSE) #刪除圖例
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment