Thanks for your help, 
I directly use the sp module for creating points, it's more elegant than using 
assignment.
Now, I can krige my datas in Rpy, it's fun, but I don't understand why can I 
plot some graphics, and others not :
########################
from rpy import *
r.library("gstat")
set_default_mode(NO_CONVERSION)
df=r.data_frame(x=x, y=y, conc=conc)
coords=r.SpatialPoints(r.data_frame(x=x, y=y))
sp_df=r.SpatialPointsDataFrame(coords, df)
x_range=linspace(x.min(),x.max(),num=500,endpoint=True)
y_range=linspace(y.min(),y.max(),num=500,endpoint=True)
grid=list()
for i in y_range:
    for j in x_range:
        grid.append([j, i])

grid=array(grid)
X=grid[:,0]
Y=grid[:,1]
COORDS=r.SpatialPoints(r.data_frame(x=X, y=Y))
GRID=r.SpatialPointsDataFrame(COORDS, r.data_frame(x=X, y=Y))
r.plot(GRID, cex=0.5) # <== Works good
r.points(sp_df, pch=1, col='red', cex=0.7) # <== Works good
concr=r.assign('conc', conc)
g=r.gstat(id='conc', formula=r('conc~1'), data=sp_df)
v=r.variogram(g, alpha=r.c(0,45,90,135))
#r.plot(v) # <== Doesn't work, returns the address of the R object
########################################
How can I make the variogram plot, it's the most important?
thanks

Le jeudi 13 décembre 2007, Peter a écrit :
> Lionel Roubeyrie wrote:
>  > I know that cc=r.assign("coordinates(d)", c) is false, but I don't
>  > find a way to assign columns names : r.coordinates(d)=c is also wrong.
>  > It's certainly a stupid question, but how do you do that?
>
> There are probably more elegant solutions... but have you tried
> something like this:
>
> r("colnames(d) <- c(%s)" % ",".join(c))
>
> Or this little example, which creates a variable "x" within R,
>
> from rpy import r
> r("x <- matrix(c(1,2,3,4,5,6), nrow=3, ncol=2)")
> r("colnames(x) <- c('one','two')")
> r("rownames(x) <- c('a','b','c')")
> r("print(x)")
> r("dim(x)")
>
> Peter



-- 
Lionel Roubeyrie - [EMAIL PROTECTED]
Chargé d'études et de maintenance
LIMAIR - la Surveillance de l'Air en Limousin
http://www.limair.asso.fr


-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to