try: obs_data<- c(26,43,20,14,18); pre_gam<-c(26.284,61.101,29.016,11.160,11.439) (obs.hist <- hist(obs_data, breaks = 10, plot = FALSE)); plot(obs.hist) plot(obs.hist, border = "dark blue", col = "light blue", xlab ="whatever") (pre.hist <- hist(pre_gam, breaks = 10, plot = FALSE)); lines(pre.hist, col = "Midnight Blue")
You can manipulate the number of breaks to reflect different bin widths. hth y Roslina Zakaria wrote: > > Hi r-expert, > How do I plot this 2 histogram side by side so that it is easy to compare > for bin range 0,5,10,15, 20 and more > obs_data pre_gam > [1,] 2695 2677.284 > [2,] 43 61.101 > [3,] 20 29.016 > [4,] 14 11.160 > [5,] 18 11.439 > Thanks in advance. > > > > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > ----- Yasir H. Kaheil Catchment Research Facility The University of Western Ontario -- View this message in context: http://www.nabble.com/plot-2-bars-tp17222387p17222757.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.