Skip to content

help on Polygon(sp)?

6 messages · Virgilio Gómez-Rubio, zhijie zhang, Roger Bivand +1 more

#
Hi,

El mi?, 21-03-2007 a las 22:45 +0800, zhijie zhang escribi?:
I think that you could try as.points(coordinates(guichi)) here to get
the boundary in the appropriate format. As far as I know, khat does not
use sp objects. 

Best regards,

Virgilio
#
Hi,
The problem is not in Kenv.label() but in rlabel(), which is called from
Kenv.label and that has versions in Splancs and Spatstat. So, if you
loaded Spatstat after Splancs, then you will be using the 'wrong' (non-
Splancs) version. My advice is to load Splancs only and do the analysis.

I think you could use Spatstat as well to get the envelopes of the K-
function (using envelope() ) but it might require a few more lines of
code.

Best,

Virgilio

P.S: Is it wise to use variable names with underscore in it?
#
On Wed, 21 Mar 2007, Virgilio G?mez-Rubio wrote:

            
These things do happen, I think that neither splancs nor spatstat have 
namespaces, which restrict the visibility of functions, so here you need 
to be careful. The warning:

        The following object(s) are masked from package:splancs :

         rlabel 

should have been displayed.
And if you use spatstat, you can convert the SpatialPolygons to owin with 
functions in maptools:

as(guichi, "owin")

ought to do it.

Roger

  
    
#
Hello, I'm having trouble with using the alpha channel for transparency 
with lines with spplot and
sp.lines.

If I use transparency via the alpha argument to rgb to overplot lines on 
spplot.grid the transparent colour affects all of the colours in the 
plot.  Example follows.

I've put the pdfs as created below here for reference:

http://staff.acecrc.org.au/~mdsumner/Rutas/misc/

BTW, I know my usage of the panel plots is not right, but I'm learning, 
so any advice would be appreciated.

Cheers, Mike.

I'm using Windows XP, SP2 with

R version 2.4.1 (2006-12-18)
i386-pc-mingw32

locale:
LC_COLLATE=English_Australia.1252;LC_CTYPE=English_Australia.1252;LC_MONETARY=English_Australia.1252;LC_NUMERIC=C;LC_TIME=English_Australia.1252

attached base packages:
[1] "stats"     "graphics"  "grDevices" "utils"     "datasets"  "methods" 
[7] "base"    

other attached packages:
     sp
"0.9-9"


Example:
library(sp)

data(meuse.grid)
coordinates(meuse.grid) <- ~x+y
gridded(meuse.grid) <- TRUE

## create some lines

bb <- bbox(meuse.grid)
xy <- cbind(runif(10, bb[1,1], bb[1,2]), runif(10, bb[2,1], bb[2,2]))
ll <- SpatialLines(list(Lines(list(Line(xy)), "1")))


## this is fine, colour grid with black lines
pdf("test.pdf", version = "1.4")
pg <- function(...) {
    panel.gridplot(...)
    sp.lines(ll)
}
spplot(meuse.grid[1], panel = pg)
dev.off()

## in this the colour grid is "greyed" like the lines
pdf("testAlpha.pdf", version = "1.4")
pg <- function(...) {
    panel.gridplot(...)
    sp.lines(ll , col = rgb(190, 190, 190, 100, max = 255))
}
spplot(meuse.grid[1], panel = pg)
dev.off()

## try with blue lines - colour grid is "blued" . . .
pdf("testBlueAlpha.pdf", version = "1.4")
pg <- function(...) {
    panel.gridplot(...)
    sp.lines(ll , col = rgb(0, 0, 190, 100, max = 255))
}
spplot(meuse.grid[1], panel = pg)
dev.off()