mirror of
https://github.com/qgis/QGIS.git
synced 2025-06-17 00:03:34 -04:00
Merge pull request #992 from fsdias/master
Fix Relative_distribution_(distance_covariate).rsx
This commit is contained in:
commit
a30a9dd05e
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user