R语言做箱形图

R语言做箱形图

library(ggplot2)

# loading data set and storing it in ds variable
ds <- read.csv(
  "csv文件路径", header = TRUE)

crop3<-ggplot(ds, aes(x = Source, y = Proportional_contribution, fill = Source)) + 
  geom_boxplot(outlier.shape = NA) #隐藏异常点不显示
#+ geom_jitter(position=position_jitter(0.2)) 显示所有的点

#设置每个box的颜色
crop3+scale_fill_manual(values=c("red", "yellow", "blue",
                                 "green","purple"))

你可能感兴趣的:(R,r语言,开发语言)