[R] matching two plots

Rui Cardoso rrc at fct.unl.pt
Wed Oct 19 19:27:00 CEST 2005


Hi,

I have a problem about graphics. I would like to plot two graphs: a barplot 
and curve. Here is the code:

 > barplot(dpois(0:45,20),xlim=c(0,45),names=0:45)
 > curve(dnorm(x,20,sqrt(20)),from=0,to=45,add=T)

Both graphs are drawn in the same figure, however the scale in both graphs 
dooes not match. For some reason the second plot is shifted to left. I 
think there is a problem concerning the axis scale.

Thanks a lot.

Rui




More information about the R-help mailing list