Skip to content

Instantly share code, notes, and snippets.

@gtgrthrst
Created June 14, 2021 07:33
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/7a9fc013d884812667a22a54a7925c6f to your computer and use it in GitHub Desktop.
Save gtgrthrst/7a9fc013d884812667a22a54a7925c6f to your computer and use it in GitHub Desktop.
library(ggplot2)
cities <- c(rep("Delhi", 3), rep("Mumbai", 3),
rep("Chennai", 3), rep("Bengaluru", 3))
humidity <- rep(c("High", "Medium", "Low"), 4)
temperature <- abs(rnorm(12, 25, 10))
dataframe <- data.frame(cities, humidity,
temperature)
ggplot(dataframe, aes(fill = humidity,
y = temperature, x = cities))+
geom_bar(position = "fill", stat = "identity")+
theme(plot.title = element_text(hjust = 0.5))+
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