[R] scatter plot and marginal

Kjetil Brinchmann Halvorsen kjetil at acelerate.com
Mon Oct 4 17:02:39 CEST 2004


Paolo Bulla wrote:

>Hallo,
>
>I would like to add the marginal distributions along the X and the Y axis to a
>scatter plot.
>Can anybody help me, please?
>
>Thank you,
> Paolo
>  
>
The simplest thing you can do is like
plot(x, y)
rug(x, side=1, col="red")
rug(y, side=2, col="red")

or if there are many coincident x (y) values
rug(jitter(x), side=1, col="red")
rug(jitter(y), side=2, col="red")

Kjetil

-- 

Kjetil Halvorsen.

Peace is the most effective weapon of mass construction.
               --  Mahdi Elmandjra




More information about the R-help mailing list