Histogram with marginal boxplot in R -
how make matching x-axis in histogram marginal boxplot?
data <- rnorm(1000) nf <- layout(mat = matrix(c(1,2),2,1, byrow=true), height = c(1,3)) layout.show(nf) par(mar=c(5.1, 4.1, 1.1, 2.1)) boxplot(data, horizontal=true, outline=false) hist(data)
one solution set ylim=
in boxplot()
same range xlim=
in hist()
.
set.seed(123) data <- rnorm(1000) nf <- layout(mat = matrix(c(1,2),2,1, byrow=true), height = c(1,3)) par(mar=c(5.1, 4.1, 1.1, 2.1)) boxplot(data, horizontal=true, outline=false,ylim=c(-4,4)) hist(data,xlim=c(-4,4))
Comments
Post a Comment