From a0b5e94a78ae3586c02f707b889c5d3f33e0e1ea Mon Sep 17 00:00:00 2001 From: fsdias Date: Tue, 12 Nov 2013 10:03:45 +0000 Subject: [PATCH 1/2] Update Relative_distribution_(distance_covariate).rsx --- ...tive_distribution_(distance_covariate).rsx | 67 +++++++------------ 1 file changed, 25 insertions(+), 42 deletions(-) diff --git a/python/plugins/processing/r/scripts/Relative_distribution_(distance_covariate).rsx b/python/plugins/processing/r/scripts/Relative_distribution_(distance_covariate).rsx index 9494ce552b6..e47e3f0af02 100644 --- a/python/plugins/processing/r/scripts/Relative_distribution_(distance_covariate).rsx +++ b/python/plugins/processing/r/scripts/Relative_distribution_(distance_covariate).rsx @@ -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 +} From fb08949319f9197be2ffb74707e091c52cc034d9 Mon Sep 17 00:00:00 2001 From: fsdias Date: Tue, 19 Nov 2013 11:11:25 +0000 Subject: [PATCH 2/2] Create Advanced_raster_histogram.rsx --- .../r/scripts/Advanced_raster_histogram.rsx | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 python/plugins/processing/r/scripts/Advanced_raster_histogram.rsx diff --git a/python/plugins/processing/r/scripts/Advanced_raster_histogram.rsx b/python/plugins/processing/r/scripts/Advanced_raster_histogram.rsx new file mode 100644 index 00000000000..14e7e460dd7 --- /dev/null +++ b/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) +} +}