i need plot histograms , graph in same plot. having problem ggplot2 becouse dataset big.
what can do?
here example
lambda=seq(0,1,length.out=100) b1=lambda^2 b2=lambda^2+1 b=cbind(b1,b2) perc=rnorm(100) matplot(lambda,b) hist(perc) thanks :d
sorry question not clear. need have b , histogram overlapped in same plot. plot in slide.
this time can not use ggplot becouse dataset big , takes times.
you not (yet) using ggplot2, , if need other commands control layout, think want (for base graphics) par command.
lambda=seq(0,1,length.out=100) b1=lambda^2 b2=lambda^2+1 b=cbind(b1,b2) perc=rnorm(100) par(mfrow = c(2,1)) matplot(lambda,b) hist(perc) this yields matplot top chart, , hist second chart.
if want side-by-side, use par(mfrow = c(1,2)).
as noted in comments, if want them on top of each other call `par(new = true) in between plot commands follows:
matplot(lambda,b) par(new = true) hist(perc)
Comments
Post a Comment