0
我想使用此代碼,但得到2個問題: 1 - 傳說中的一個額外的作物 2 - 不匹配傳奇傳說不匹配的數據
#datalocation
scdata=read.csv("SeedcountR.csv")
library(ggplot2)
library(RColorBrewer)
##Group the data by Rotation
scdata$rotation[scdata$Rot.Trt %in% c("C2", "S2")]<-"TwoYear"
scdata$rotation[scdata$Rot.Trt %in% c("C3", "S3", "O3")]<-"ThreeYear"
scdata$rotation[scdata$Rot.Trt %in% c("C4", "S4", "O4", "A4")]<-"FourYear"
##Plot
scdata$rotation <- factor(scdata$rotation, levels = c("TwoYear", "ThreeYear", "FourYear"))
ggplot(scdata, aes(Rot.Herb, Count, fill=Crop))+
geom_boxplot()+
facet_grid(~rotation, scales = "free_x", space="free_x")+
scale_fill_brewer(palette = "Paired")+
ggtitle("Weed seedbank by subplot")+
theme(plot.title = element_text(size=30, face="bold", vjust=2))+
xlab("Rotation systems and Herbicide regimes (L = Low herbicide regime, C = Conventional herbicide regime)")+
scale_x_discrete(labels = c("Corn C", "Corn L", "Soybean C", "Soybean L", "Corn C", "Corn L", "Oat C", "Oat L", "Soybean C", "Soybean L", "Alfalfa C", "Alfalfa L", "Corn C", "Corn L", "Oat C", "Oat L", "Soybean C", "Soybean L"))+
theme(axis.text.x = element_text(angle = 90, hjust = 1))+
ylab("Weed seed count")
請找結果情節和這裏的數據 Data and plot
你能否澄清你的意思'2個問題:1 - 不匹配legend' - 傳說中的2額外的收成?這個描述看起來太寬泛,不知道發生了什麼。 – jazzurro