r - Resize margins between different plots in one graph -


i want plot 3 plots 1 graph using layout command below. unfortunately margins between plot 1 , 2 quite big. tried "heights=c()" command don't want change proportion between both plots. love have same size both plots, therefore decrease margin between, haven't found adequate solution yet , not sure how use par(mar) command in here.

layout(matrix(c(1,1,3,2,2,3),2,3,byrow=true)) hist(data$x,breaks=16,prob=true,xlab="x",ylab="density",main="",ylim=c(0.000,0.040)) axis(side=1,at=seq(40,120,10),labels=seq(40,120,10)) lines(density(data$x,na.rm=true), col="blue", lwd=2) lines(density(data$x,na.rm=true, adjust=2),lty="dotted",col="darkgreen", lwd=2) qqnorm(data$x,main="") boxplot(data$x) 

thank assistance. there possibility use ggplot aes() instead?

thanks lot!

thore

it appears me excess whitespace entirely caused combination of top , bottom margins between under , on figures. playing around mar, looks me can fix decreasing both top , bottom margins default of c(5,4,4,2)+0.1 c(4,4,1,1)+0.1 (note: decreased right margin evenness) (note: since didn't provide data, synthesized normal distribution):

set.seed(1); data <- data.frame(x=rnorm(100,80,15)) par(mar=c(4,4,1,1)+0.1)  layout(matrix(c(1,1,3,2,2,3),2,3,byrow=true)) hist(data$x,breaks=16,prob=true,xlab="x",ylab="density",main="",ylim=c(0.000,0.040)) axis(side=1,at=seq(40,120,10),labels=seq(40,120,10)) lines(density(data$x,na.rm=true), col="blue", lwd=2) lines(density(data$x,na.rm=true, adjust=2),lty="dotted",col="darkgreen", lwd=2) qqnorm(data$x,main="") boxplot(data$x) 

plot


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -