Hi everyone,

I'm trying to rebuild a R example in rpy2 given in this thread in
stackoverflow:
http://stackoverflow.com/questions/3541713/how-to-plot-two-histograms-together-in-r.
The example looks like this:

    set.seed(42)
    p1 <- hist(rnorm(500,4))                     # centered at 4
    p2 <- hist(rnorm(500,6))                     # centered at 6
    plot( p1, col=rgb(0,0,1,1/4), xlim=c(0,10))  # first histogram
    plot( p2, col=rgb(1,0,0,1/4), xlim=c(0,10), add=T)  # second

This creates two histograms in one plot, with one histogram being blue, the
other being pink and the overlap being purple. You can paste and run this
in R to see the result.
So I made the following in rpy2:


    R.r['set.seed(42)']
    p1 = R.r['hist'](rnorm(500,4))                     # centered at 4
    p2 <- hist(rnorm(500,6))                     # centered at 6
    plot( p1, col=rgb(0,0,1,1/4), xlim=c(0,10))  # first histogram
    plot( p2, col=rgb(1,0,0,1/4), xlim=c(0,10), add=T)  # second
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to