r - labelling two summary data in one boxplot -


i new user of r. • combine results of these 2 groups , still maintain labels 2 groups. when combine, yield figure, has lost labels. • label number 1 , 2 (for both groups) “falling” , “falling-rising”. respectively , “black” , “grey” color show difference easily. • working summary results

this formula have used far create figure:

d0<-matrix(c(x1,x2), ncol=2) d1<-matrix(c(y1,y2), ncol=2) lmts<-range(d0,d1) par(mfrow = c(1, 2)) boxplot(d0, ylim=lmts, xlab="x") boxplot(d1, ylim=lmts, xlab="y") result1 <-boxplot(d0, ylim=lmts, xlab="x") result2<- boxplot(d1, ylim=lmts, xlab="y") mylist <- list(result1, result2) groupbxp <- do.call(mapply, c(cbind, mylist)) bxp(groupbxp) 

like this?

set.seed(1)   # example reproduceable # create example x1=sample(50,100,10) x2=sample(50,100,10) y1=sample(50,100,10) y2=sample(50,100,10) d0<-data.frame(falling=x1,"falling-rising"=x2)  # note use of data.frame(...) d1<-data.frame(falling=y1,"falling-rising"=y2) lmts<-range(d0,d1) par(mfrow = c(1, 2)) boxplot(d0, ylim=lmts, xlab="x", col=c("grey80","grey50")) boxplot(d1, ylim=lmts, xlab="y", col=c("grey80","grey50")) result1 <-boxplot(d0, ylim=lmts, xlab="x", plot=f) result2<- boxplot(d1, ylim=lmts, xlab="y", plot=f) mylist <- list(result1, result2) groupbxp <- do.call(mapply, c(cbind, mylist)) par(mfrow=c(1,1)) bxp(groupbxp,fill=t,boxfill=c("grey80","grey50","grey80","grey50")) 

to labels other x, y use data.frame(...) instead of matrix(...). colors use boxfill=... in call bxp(...). note, though, colors in boxplot(...) arguments different, sadly.


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -