# library library(ggplot2) # create a dataset specie <- c(rep("sorgho" , 3) , rep("poacee" , 3) , rep("banana" , 3) , rep("triticum" , 3) ) condition <- rep(c("normal" , "stress" , "Nitrogen") , 4) value <- abs(rnorm(12 , 0 , 15)) data <- data.frame(specie,condition,value) # Grouped ggplot(data, aes(fill=condition, y=value, x=specie)) + geom_bar(position="dodge", stat="identity")

R语言 ggplot2 柱状图

 # library
library(ggplot2)
 
# create a dataset
specie <- c(rep("sorgho" , 3) , rep("poacee" , 3) , rep("banana" , 3) , rep("triticum" , 3) )
condition <- rep(c("normal" , "stress" , "Nitrogen") , 4)
value <- abs(rnorm(12 , 0 , 15))
data <- data.frame(specie,condition,value)
 
# Stacked
ggplot(data, aes(fill=condition, y=value, x=specie)) + 
    geom_bar(position="stack", stat="identity")

R语言 ggplot2 柱状图

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-17
  • 2022-12-23
猜你喜欢
  • 2021-11-22
  • 2021-05-15
  • 2022-02-02
  • 2021-07-05
  • 2021-11-16
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案