Roopa Subbaiaih
2014-May-05 19:02 UTC
[R] Sciplot: Increasing the width of bargraph and decreasing the sapce b/n groups
Hello, I am trying to plot bargraphs susing Sciplot. Is there a way to increase the width of the bar graphs and decrease the space b/n the groups? I am pasting the script as well as attaching the graph. Bio6 <- read.csv("Data/Plin1.csv",na.strings="",header=T) attach(Bio6) head(Bio6) par(family="serif", font=11) Bio6$Sps <- factor(Bio6$Sps, levels = c("FFA1", "FFA2","FFA3")) Bio6$Gp <- factor(Bio6$Gp, levels = c("N-FFA1", "FU1","FA1","N-FFA2","FU2","FA2","N-FFA3","FU3","FA3")) bargraph.CI(Sps, O.D, group = Gp, data = Bio6,ylab = "Relative expression levels", cex.lab = 1.5, y.leg = 6,cex.leg = 0.82,cex=1.5, axisnames=TRUE, col = c("red","blue","grey"),space=c(0, 0.5), ylim=c(0,7),cex.names 1.0,density = c(30,30,30), legend = TRUE, main="PLIN1") detach(Bio6) O.D Gp Sps 1 1.000000 N-FFA1 FFA1 2 2.996432 FU1 FFA1 3 3.223413 FU1 FFA1 4 3.524465 FU1 FFA1 5 1.311971 FA1 FFA1 6 6.755860 FA1 FFA1 7 1.566000 FA1 FFA1 8 1.000000 N-FFA2 FFA2 9 2.741612 FU2 FFA2 10 2.800644 FU2 FFA2 11 3.569509 FU2 FFA2 12 4.141500 FA2 FFA2 13 7.049476 FA2 FFA2 14 4.694674 FA2 FFA2 15 1.000000 N-FFA3 FFA3 16 4.163601 FU3 FFA3 17 3.903986 FU3 FFA3 18 4.730000 FU3 FFA3 19 0.000000 FA3 FFA3 20 0.000000 FA3 FFA3 21 0.000000 FA3 FFA3 Any help would be appreciated. Thanks in advance, Roopa
Jim Lemon
2014-May-05 22:02 UTC
[R] Sciplot: Increasing the width of bargraph and decreasing the sapce b/n groups
On 05/06/2014 05:02 AM, Roopa Subbaiaih wrote:> Hello, > > I am trying to plot bargraphs susing Sciplot. Is there a way to increase > the width of the bar graphs and decrease the space b/n the groups? I am > pasting the script as well as attaching the graph. > > Bio6<- read.csv("Data/Plin1.csv",na.strings="",header=T) > attach(Bio6) > head(Bio6) > par(family="serif", font=11) > Bio6$Sps<- factor(Bio6$Sps, levels = c("FFA1", "FFA2","FFA3")) > Bio6$Gp<- factor(Bio6$Gp, levels = c("N-FFA1", > "FU1","FA1","N-FFA2","FU2","FA2","N-FFA3","FU3","FA3")) > bargraph.CI(Sps, O.D, group = Gp, data = Bio6,ylab = "Relative expression > levels", cex.lab = 1.5, y.leg = 6,cex.leg = 0.82,cex=1.5, axisnames=TRUE, > col = c("red","blue","grey"),space=c(0, 0.5), ylim=c(0,7),cex.names > 1.0,density = c(30,30,30), legend = TRUE, main="PLIN1") > detach(Bio6) > > O.D Gp Sps > 1 1.000000 N-FFA1 FFA1 > 2 2.996432 FU1 FFA1 > 3 3.223413 FU1 FFA1 > 4 3.524465 FU1 FFA1 > 5 1.311971 FA1 FFA1 > 6 6.755860 FA1 FFA1 > 7 1.566000 FA1 FFA1 > 8 1.000000 N-FFA2 FFA2 > 9 2.741612 FU2 FFA2 > 10 2.800644 FU2 FFA2 > 11 3.569509 FU2 FFA2 > 12 4.141500 FA2 FFA2 > 13 7.049476 FA2 FFA2 > 14 4.694674 FA2 FFA2 > 15 1.000000 N-FFA3 FFA3 > 16 4.163601 FU3 FFA3 > 17 3.903986 FU3 FFA3 > 18 4.730000 FU3 FFA3 > 19 0.000000 FA3 FFA3 > 20 0.000000 FA3 FFA3 > 21 0.000000 FA3 FFA3 >Hi Roopa, bargraph.CI does something with the "space" argument that I can't quite work out. I can get a reasonable plot like this: Bmeans<-matrix(by(Bio6$O.D,Bio6$Gp],FUN=mean),ncol=3) barpos<-barplot(Bmeans,beside=TRUE, ylim=c(0,7),col=c("red","blue","grey"),space=c(0.1,1),main="PLIN1") legend(8.5,7.1, c("N-FFA1","FU1","FA1","N-FFA2","FU2","FA2","N-FFA3","FU3","FA3"), fill=c("red","blue","grey"),bty="n") library(plotrix) Bse<-matrix(by(Bio6$O.D,Bio6$Gp,FUN=std.error),ncol=3) dispersion(barpos,Bmeans,Bse,display.na=FALSE) Jim