0

私は一連の棒グラフを作成していますが、これはすべて、次のコードを使用して生成するものとかなり似ています。

これに関する多くの投稿を見てきましたが、関心のある変数の順序を変更しようとしましたが、うまくいきません。任意のヒント?

library(ggplot2)

trtslope<-structure(list(Geno = structure(c(5L, 5L, 5L, 5L, 5L, 5L, 5L), .Label = c("1a", "1b", "1c", "1d", "1e", "1f", "2co", "2h", "4f", "5t", "pin3", "pin3pin7"), class ="factor"), Light = structure(c(2L,2L, 2L, 2L, 2L, 2L, 2L), .Label = c("Constant","Cycle"),class = "factor"),     Trmt = structure(c(6L, 3L, 5L, 2L, 7L, 4L, 1L), .Label = c("None","10^-11Kin", "10^-10Kin", "10^-9Kin", "10^-11IAA", "10^-10IAA", 
"10^-9IAA"), class = "factor"), mean = c(-1.54504597523189, 
-1.53362395751867, -1.57385562758997, -1.54322151503139, 
-1.66574978029235, -1.32095137998064, -1.36520900266343), 
sd = c(0.46315259286543, 0.458985115845406, 0.482009142703553, 
0.641786961061545, 0.590265055416619, 0.378034730883596, 
0.400241364404397), ste = c(0.0545830565232129, 0.0564971622467328, 
0.0607274438691926, 0.0789985139281606, 0.0647900070055787, 
0.0417469522407694, 0.0292685472783953), Conc = c("10^-10", 
"10^-10", "10^-11", "10^-11", "10^-9", "10^-9", "None"), 
Group = c("IAA", "Kinetin", "IAA", "Kinetin", "IAA", "Kinetin", 
"None")), .Names = c("Geno", "Light", "Trmt", "mean", "sd", "ste", "Conc", "Group"), row.names = c(13L, 14L, 17L, 18L, 31L, 32L, 37L), class = "data.frame")

trtslopeplot<-ggplot(trtslope, aes(x=Group, y=mean, fill=Conc))+ geom_bar(stat="identity", position  = position_dodge())+geom_errorbar(aes(ymin=mean-ste, ymax=mean+ste),position=position_dodge(.9),width=.2)

#I've tried to reorder the factors as I've done in the past, but that doesn't seem to work to change the plot

trtslope$Trmt <- factor( as.character(trtslope$Trmt), levels= c("None","10^-11Kin","10^-10Kin","10^-9Kin","10^-11IAA","10^-10IAA","10^-9IAA"))
trtslope <- trtslope[order(trtslope$Trmt),]
4

0 に答える 0