This is my code:
library(ggplot2) ifile <- read.table("C:/files/text.lu", skip = 2, header = TRUE, sep="\\t") ifileVf2 <- data.frame(ifile["Vf2"], ifile["Site"]) quantiles <- quantile(ifileVf2$Vf2[ifileVf2$Site == '1'], c(0.001, 0.999)) Site_1_Values <- hist(ifileVf2$Vf2[(ifileVf2$Site == '1') & (ifileVf2$Vf2 > quantiles[1]) & (ifileVf2$Vf2 < quantiles[2])], breaks=150, freq=TRUE, right=TRUE) quantiles <- quantile(ifileVf2$Vf2[ifileVf2$Site == '2'], c(0.001, 0.999)) Site_2_Values <- hist(ifileVf2$Vf2[(ifileVf2$Site == '2') & (ifileVf2$Vf2 > quantiles[1]) & (ifileVf2$Vf2 < quantiles[2])], breaks=150, freq=TRUE, right=TRUE) par(mfrow=c(2,1)) plot( Site_1_Values, col=rgb(0,0,1,1/4), panel.first = grid()) plot( Site_2_Values, col=rgb(0,1,0,1/4), add=T, panel.first = grid())
This is the Result:
How do i get two histograms into different panels but common x-axis?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.