Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #992 from fsdias/master
Fix Relative_distribution_(distance_covariate).rsx
  • Loading branch information
volaya committed Jan 24, 2014
2 parents c3f4bef + fb08949 commit a30a9dd
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 42 deletions.
20 changes: 20 additions & 0 deletions python/plugins/processing/r/scripts/Advanced_raster_histogram.rsx
@@ -0,0 +1,20 @@
##Layer=raster
##Raster processing=group
##Dens_or_Hist=string Hist
##showplots
library(rpanel)
library(rasterVis)
str <- Dens_or_Hist
if (str !='Dens' & str != 'Hist'){
rp.messagebox('you must enter "Dens" or "Hist"', title = 'oops!')
} else {
if (nbands(Layer) == 1) {
Layer <- as.matrix(Layer)
Layer <- raster(Layer)
}
if (str == 'Dens') {
densityplot(Layer)
} else if (str == 'Hist') {
histogram(Layer)
}
}
@@ -1,42 +1,25 @@
(dp0
S'ALG_DESC'
p1
VThis algorithm creates a graph that demonstrates the dependency of the intensity of the point process on the value of covariate. In this algorithm the covariate is the distance to the certain objects. The functionality is based on 'rhohat' function of the 'spatstat' package. \u000a\u000aR dependencies: library "maptools", "spatstat" and "rpanel".
p2
sS'ALG_CREATOR'
p3
VYury Ryabov\u000a2013\u000ariabovvv@gmail.com
p4
sS'Layer'
p5
VThe point process which distribution will be investigated.
p6
sS'Covariate_name'
p7
VThis field is mandatory. Enter the name of the covariate. It will appear at the graph.
p8
sS'Legend_position'
p9
VThis field defines the position of the legend at the graph. 'float' means that the legend will be placed at the position that would not overlap the graph itself (or will try at least). Other options are: 'topleft', 'topright', 'bottomleft', 'bottomright'.
p10
sS'x_label'
p11
VOptional label for the X axis. Note that units at the X axis will be the same as in the input layers.
p12
sS'RPLOTS'
p13
VThe empirical graph of the dependency of the intensity of the point process on the distance to the given objects.
p14
sS'ALG_HELP_CREATOR'
p15
VYury Ryabov\u000a2013\u000ariabovvv@gmail.com
p16
sS'Plot_name'
p17
VOptional plot name.
p18
sS'Covariate'
p19
VThe set of objects the distance from which will be calculated and used as a spatial covariate to the point process.
p20
s.
##Point pattern analysis=group
##Layer=vector
##Covariate=vector
##Covariate_name=string mandatory_covariate_name_(no_spaces)
##x_label=string
##Plot_name=string
##Legend_position=string float
library(spatstat)
library(maptools)
library(rpanel)
if (Covariate_name == "") {
rp.messagebox('Covariate name must not be emply!', title = 'oops!')}
else {
S <- Layer
SP <- as(S, "SpatialPoints")
P <- as(SP, "ppp")
r <- Covariate
rp <- as.psp(r)
rdist <- distfun(rp)
plot(rhohat(P, rdist, covname=Covariate_name), xlab= x_label,
legendpos = Legend_position,
legendargs=list(bg="transparent"),
main = Plot_name)
##showplots
}

0 comments on commit a30a9dd

Please sign in to comment.