2 graphics superposed, pb of scale

hi
i have this code :

lam1=6
n=100
X1=rexp(n,rate=lam1)#realisations
d=0.05
s1=seq(from=0, to=1.5, by=d)
dev.off()
h1=hist(X1,
        breaks=s1, freq=F, col="blue", xlim=c(0,1.5), ylim=c(0,4) )
yv1=dexp(x=s1,rate=lam1)
par(new=TRUE)
matplot(x=s1,y=yv1, type="l", col="green", lwd=2 , axes=F,
      las=1, xaxs = "i", yaxs = "i",xlab="",ylab="",
      xlim=c(0,1.5), ylim=c(0,4)) 

here the result : [i am sorry i am not authorized to post either images nor dropbox links]

my question :
would you have an idea why the y=0 axis seems not to be the same for the hist than for the matplot ?

:slight_smile:
Vinz

visual inspection of h1 / hist shows the axis dont touch by default, so also use the same xaxs = "i",yaxs="i" for hist as you do for matplot ?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.