Hi,

I mange to import rpy to python and I can use R functions, but not plot.
No plot window appears with this code:

import rpy
x = range(0, 10)
y = [ 2*i for i in x ]
r.plot_default(x, y)
r.plot(x,y)

As well, I cannot save plot to file, as can be seen from this example:

my_x = [5.05, 6.75, 3.21, 2.66]
my_y = [1.65, 26.5, -5.93, 7.96]
ls_fit = r.lsfit(my_x,my_y)
gradient = ls_fit['coefficients']['X']
yintercept = ls_fit['coefficients']['Intercept']
r.png("scatter_regression.png", width=400, height=350)
r.plot(x=my_x, y=my_y, xlab="x", ylab="y", xlim=(0,7), ylim=(-16,27),
main="Exmple Scttr w/regression")
r.abline(a=yintercept, b=gradient, col="red")

The .png file is created but it is empty.

I am running Ubuntu 9.04 Python, Numpy, Scipy, and rpy installed from
the repositories. I don't remember if I installed R from the repository
or not, but Ubuntu's apt-get recognizes that r-base has been installed
already.

Hope someone can help



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to