r - how can I plot the bar plot attached to box plot -
a small portion of data looks below
dt<- structure(c(79l, 54l, 37l, 41l, 42l, 121l, 134l, 169l, 23l, 19l, 22l, 19l, 25l), .names = c("experi_1", "experi_2", "experi_3", "experi_4", "experi_5", "experi_6", "experi_7", "experi_8", "experi_9", "experi_10", "experi_11", "experi_12", "experi_13"))
what try make make barplot assigned box plot under have read comment , tried use no success
a bar plot can drawn this. however, have no control on x-axis. example if want plot distance of 5, cannot. lets 1, 5, 10 , 13 x-axis label. anyway not big issue. problem assigning box plot barplot!
barplot(dt, xlab="number of s in each experiment")
i used following add box plot, not seem
xlim <- c(-0.5, 0.5) + range(dt) par(mar=c(3.1, 3.1, 1.1, 2.1)) boxplot(dt, horizontal=true, outline=true, ylim=xlim, frame=f, width = 10)
i think problem don't split window. use layout()
(as suggested post).
layout(mat = matrix(c(1,2),2,1, byrow=true), height = c(3,1)) par(mar=c(3.1, 3.1, 1.1, 2.1)) barplot(dt, main="distribution", xlab="number of each experiment") boxplot(dt, horizontal=true, outline=true, frame=f, width = 10)
Comments
Post a Comment