[GRASS-SVN] r69716 - in grass-addons/grass7/raster: . r.scatterplot

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Oct 22 10:10:13 PDT 2016


Author: wenzeslaus
Date: 2016-10-22 10:10:13 -0700 (Sat, 22 Oct 2016)
New Revision: 69716

Added:
   grass-addons/grass7/raster/r.scatterplot/
   grass-addons/grass7/raster/r.scatterplot/r.scatterplot.html
   grass-addons/grass7/raster/r.scatterplot/r_scatterplot.png
Removed:
   grass-addons/grass7/raster/r.scatterplot/r3.scatterplot.html
   grass-addons/grass7/raster/r.scatterplot/r3_scatterplot.png
   grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_2_variables.png
   grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_2_variables_3rd_color.png
   grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_2_variables_3rd_z.png
   grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_2_variables_3rd_z_4th_color.png
   grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_2_variables_3rd_z_4th_color2.png
   grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_2d.png
   grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_3_variables.png
   grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_3_variables_3_colors.png
   grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_3_variables_3_colors_overlap.png
Modified:
   grass-addons/grass7/raster/Makefile
   grass-addons/grass7/raster/r.scatterplot/Makefile
   grass-addons/grass7/raster/r.scatterplot/main.c
Log:
r.scatterplot: scatter plot as vector points, 2D raster verion of r3.scatterplot (r69572)

Modified: grass-addons/grass7/raster/Makefile
===================================================================
--- grass-addons/grass7/raster/Makefile	2016-10-20 20:26:55 UTC (rev 69715)
+++ grass-addons/grass7/raster/Makefile	2016-10-22 17:10:13 UTC (rev 69716)
@@ -84,6 +84,7 @@
 	r.rock.stability \
 	r.roughness.vector \
 	r.sample.category \
+	r.scatterplot \
 	r.series.decompose \
 	r.series.diversity \
 	r.shaded.pca \


Property changes on: grass-addons/grass7/raster/r.scatterplot
___________________________________________________________________
Added: svn:ignore
   + OBJ.*
*.tmp.html


Modified: grass-addons/grass7/raster/r.scatterplot/Makefile
===================================================================
--- grass-addons/grass7/raster3d/r3.scatterplot/Makefile	2016-09-28 23:55:37 UTC (rev 69601)
+++ grass-addons/grass7/raster/r.scatterplot/Makefile	2016-10-22 17:10:13 UTC (rev 69716)
@@ -1,9 +1,9 @@
 MODULE_TOPDIR = ../..
 
-PGM = r3.scatterplot
+PGM = r.scatterplot
 
-LIBES = $(RASTER3DLIB) $(VECTORLIB) $(GISLIB) $(MATHLIB)
-DEPENDENCIES = $(RASTER3DDEP) $(VECTORDEP) $(GISDEP)
+LIBES = $(RASTERLIB) $(VECTORLIB) $(GISLIB) $(MATHLIB)
+DEPENDENCIES = $(RASTERDEP) $(VECTORDEP) $(GISDEP)
 
 EXTRA_INC = $(VECT_INC)
 EXTRA_CFLAGS = $(VECT_CFLAGS)

Modified: grass-addons/grass7/raster/r.scatterplot/main.c
===================================================================
--- grass-addons/grass7/raster3d/r3.scatterplot/main.c	2016-09-28 23:55:37 UTC (rev 69601)
+++ grass-addons/grass7/raster/r.scatterplot/main.c	2016-10-22 17:10:13 UTC (rev 69716)
@@ -1,10 +1,11 @@
 /****************************************************************************
  *
- * MODULE:       r3.scatterplot
+ * MODULE:       r.scatterplot
+ *               (based on and a lot of common code with r3.scatterplot)
  *
  * AUTHOR(S):    Vaclav Petras <wenzeslaus gmail com>
  *
- * PURPOSE:      Creates a scatter plot of two or more 3D maps
+ * PURPOSE:      Creates a scatter plot of two or more raster maps
  *
  * COPYRIGHT:    (C) 2016 by the GRASS Development Team
  *
@@ -32,7 +33,7 @@
 
 #include <grass/gis.h>
 #include <grass/glocale.h>
-#include <grass/raster3d.h>
+#include <grass/raster.h>
 #include <grass/vector.h>
 
 #include "vector_mask.h"
@@ -60,31 +61,30 @@
     struct GModule *module;
 
     module = G_define_module();
-    G_add_keyword(_("raster3d"));
+    G_add_keyword(_("raster"));
     G_add_keyword(_("statistics"));
     G_add_keyword(_("diagram"));
     G_add_keyword(_("correlation"));
     G_add_keyword(_("scatter plot"));
     G_add_keyword(_("vector"));
-    G_add_keyword(_("voxel"));
-    module->label = _("Creates a scatter plot of 3D raster maps");
+    module->label = _("Creates a scatter plot of raster maps");
     module->description =
-        _("Creates a scatter plot of two or more 3D raster maps as a vector map");
+        _("Creates a scatter plot of two or more raster maps as a vector map");
 
-    opt->input = G_define_standard_option(G_OPT_R3_INPUTS);
+    opt->input = G_define_standard_option(G_OPT_R_INPUTS);
 
     opt->output = G_define_standard_option(G_OPT_V_OUTPUT);
 
-    opt->z_raster = G_define_standard_option(G_OPT_R3_INPUT);
+    opt->z_raster = G_define_standard_option(G_OPT_R_INPUT);
     opt->z_raster->key = "z_raster";
     opt->z_raster->description =
-        _("Name of input 3D raster map to define Z coordinates");
+        _("Name of input raster map to define Z coordinates");
     opt->z_raster->required = NO;
 
-    opt->color_raster = G_define_standard_option(G_OPT_R3_INPUT);
+    opt->color_raster = G_define_standard_option(G_OPT_R_INPUT);
     opt->color_raster->key = "color_raster";
     opt->color_raster->description =
-        _("Name of input 3D raster map to define category and color");
+        _("Name of input raster map to define category and color");
     opt->color_raster->required = NO;
 
     opt->xscale = G_define_option();
@@ -196,14 +196,11 @@
         G_fatal_error(_("Invalid northing: %s"), option->answers[1]);
 }
 
-static RASTER3D_Map *open_raster3d(char *name, RASTER3D_Region *region)
+int open_raster(char *name)
 {
-    RASTER3D_Map * map;
+    int map;
 
-    map = Rast3d_open_cell_old(name, G_find_raster3d(name, ""), region,
-                         RASTER3D_TILE_SAME_AS_FILE, RASTER3D_USE_CACHE_DEFAULT);
-    if (map == NULL)
-        Rast3d_fatal_error(_("Unable to open 3D raster map <%s>"), name);
+    map = Rast_open_old(name, "");
     return map;
 }
 
@@ -237,23 +234,18 @@
 
     double start_x = 0;
     double start_y = 0;
-    struct Cell_head region_2d;
+    struct Cell_head region;
 
-    G_get_window(&region_2d);
+    G_get_window(&region);
 
     if (flg.region_position->answer) {
-        start_x = region_2d.west;
-        start_y = region_2d.south;
+        start_x = region.west;
+        start_y = region.south;
     }
 
     if (opt.position->answer)
-        option_to_en(opt.position, &start_x, &start_y, &region_2d);
+        option_to_en(opt.position, &start_x, &start_y, &region);
 
-    RASTER3D_Region region;
-
-    Rast3d_init_defaults();
-    Rast3d_get_window(&region);
-
     struct Map_info output;
     struct line_pnts *points;
     struct line_cats *cats;
@@ -271,15 +263,14 @@
     points = Vect_new_line_struct();
     cats = Vect_new_cats_struct();
 
-    int rows, cols, depths;
-    int col, row, depth;
+    int rows, cols;
+    int col, row;
     char **name1, **name2;
     DCELL x, y, z;
-    FCELL fcat;
     int cat;
     int layer;
     /* actual geographical coordinates */
-    double xcoor, ycoor, unused;
+    double xcoor, ycoor;
 
     double current_max_x = -HUGE_VAL;
     double layer_x_offset = start_x;
@@ -290,25 +281,26 @@
     layer = 1;
     rows = region.rows;
     cols = region.cols;
-    depths = region.depths;
-    G_debug(1, "limits: r=%d c=%d d=%d", rows, cols, depths);
+    G_debug(1, "limits: r=%d c=%d", rows, cols);
 
-    RASTER3D_Map *z_raster = NULL;
-    RASTER3D_Map *color_raster = NULL;
+    int z_raster = -1;
+    int color_raster = -1;
 
     int n_inputs = 0;
 
     for (name1 = opt.input->answers; *name1 != NULL; name1++) {
         n_inputs++;
-        if (!G_find_raster3d(*name1, ""))
-            Rast3d_fatal_error(_("3D raster map <%s> not found"), *name1);
+        if (!G_find_raster(*name1, ""))
+            G_fatal_error(_("Raster map <%s> not found"), *name1);
     }
 
     if (opt.color_raster->answer)
-        color_raster = open_raster3d(opt.color_raster->answer, &region);
+        color_raster = open_raster(opt.color_raster->answer);
     if (opt.z_raster->answer)
-        z_raster = open_raster3d(opt.z_raster->answer, &region);
+        z_raster = open_raster(opt.z_raster->answer);
 
+    G_message("clr: %s %d", opt.color_raster->answer, color_raster);
+
     struct VectorMask vector_mask;
     int use_vector_mask = FALSE;
     if (opt.vector_mask->answer) {
@@ -319,6 +311,13 @@
         use_vector_mask = TRUE;
     }
 
+    DCELL *buffer1 = Rast_allocate_d_buf();
+    DCELL *buffer2 = Rast_allocate_d_buf();
+    DCELL *z_buffer = Rast_allocate_d_buf();
+    /* TODO: this could go directly after color
+     * skip cat if attr table or cats encode color */
+    CELL *color_buffer = Rast_allocate_c_buf();
+
     for (name1 = opt.input->answers; *name1 != NULL; name1++) {
         for (name2 = opt.input->answers; *name2 != NULL; name2++) {
             /* same name or used combination */
@@ -329,60 +328,63 @@
                 G_message(_("Putting values from <%s> and <%s> into layer %d of <%s>"),
                           *name1, *name2, layer, opt.output->answer);
             G_debug(3, "save %s + %s to %d (%s)", *name1, *name2, layer, opt.output->answer);
-            RASTER3D_Map *map1 = open_raster3d(*name1, &region);
-            RASTER3D_Map *map2 = open_raster3d(*name2, &region);
+            int map1 = open_raster(*name1);
+            int map2 = open_raster(*name2);
 
             for (row = 0; row < rows; row++) {
                 G_percent(row, rows, 1);
+                Rast_get_d_row(map1, buffer1, row);
+                Rast_get_d_row(map2, buffer2, row);
+                if (z_raster >= 0)
+                    Rast_get_d_row(z_raster, z_buffer, row);
+                if (color_raster >= 0)
+                    Rast_get_c_row(color_raster, color_buffer, row);
                 for (col = 0; col < cols; col++) {
                     /* vector mask is expensive, so we first do 2D loops */
                     if (use_vector_mask) {
-                            Rast3d_coord2location(&region, row + 0.5, col + 0.5, 0, &ycoor, &xcoor, &unused);
+                            ycoor = Rast_row_to_northing(row + 0.5, &region);
+                            xcoor = Rast_col_to_easting(col + 0.5, &region);
                             if (!VectorMask_point_in(&vector_mask, xcoor, ycoor))
                                 continue;
                     }
-                    for (depth = 0; depth < depths; depth++) {
-                        x = Rast3d_get_double(map1, col, row, depth);
-                        if (Rast_is_d_null_value(&x))
+                    x = buffer1[col];
+                    if (Rast_is_d_null_value(&x))
+                        continue;
+                    y = buffer2[col];
+                    if (Rast_is_d_null_value(&y))
+                        continue;
+                    /* TODO: better check if the raster is alive */
+                    if (z_raster >= 0) {
+                        z = z_buffer[col];
+                        if (Rast_is_d_null_value(&z))
                             continue;
-                        y = Rast3d_get_double(map2, col, row, depth);
-                        if (Rast_is_d_null_value(&y))
+                    }
+                    if (color_raster >= 0) {
+                        cat = color_buffer[col];
+                        if (Rast_is_c_null_value(&cat))
                             continue;
-                        if (z_raster) {
-                            z = Rast3d_get_double(z_raster, col, row, depth);
-                            if (Rast_is_d_null_value(&z))
-                                continue;
-                        }
-                        if (color_raster) {
-                            fcat = Rast3d_get_float(color_raster, col, row, depth);
-                            if (Rast_is_d_null_value(&fcat))
-                                continue;
-                            cat = (int) fcat;
-                            /* TODO: what to do when value cannot be cat */
-                        }
-                        x *= xscale;
-                        y *= yscale;
-                        z *= zscale;
-                        x += layer_x_offset;
-                        y += layer_y_offset;
-                        if (current_max_x < x)
-                            current_max_x = x;
-                        Vect_cat_set(cats, layer, cat);
-                        Vect_append_point(points, x, y, z);
-                        //Vect_append_point(points, xcoor, ycoor, z);
-                        Vect_write_line(&output, GV_POINT, points, cats);
-                        Vect_reset_line(points);
-                        Vect_reset_cats(cats);
-                        /* TODO: we can determine cat == GV_CAT_MAX ahead and tell user what to do */
-                        cat++;
+                        /* TODO: what to do when value cannot be cat */
                     }
+                    x *= xscale;
+                    y *= yscale;
+                    z *= zscale;
+                    x += layer_x_offset;
+                    y += layer_y_offset;
+                    if (current_max_x < x)
+                        current_max_x = x;
+                    Vect_cat_set(cats, layer, cat);
+                    Vect_append_point(points, x, y, z);
+                    //Vect_append_point(points, xcoor, ycoor, z);
+                    Vect_write_line(&output, GV_POINT, points, cats);
+                    Vect_reset_line(points);
+                    Vect_reset_cats(cats);
+                    /* TODO: we can determine cat == GV_CAT_MAX ahead and tell user what to do */
+                    cat++;
                 }
             }
             G_percent(1, 1, 1);
-            if (!Rast3d_close(map1))
-                Rast3d_fatal_error(_("Unable to close 3D raster map"));
-            if (!Rast3d_close(map2))
-                Rast3d_fatal_error(_("Unable to close 3D raster map"));
+            Rast_close(map1);
+            Rast_close(map2);
             if (!flg.one_layer->answer)
                 layer++;
             if (flg.auto_offset->answer)
@@ -393,17 +395,17 @@
     Vect_destroy_line_struct(points);
     Vect_destroy_cats_struct(cats);
 
-    if (color_raster) {
+    if (color_raster >= 0) {
         struct Colors colors;
 
-        Rast3d_read_colors(opt.color_raster->answer, G_find_raster3d(opt.color_raster->answer, ""), &colors);
+        Rast_read_colors(opt.color_raster->answer, G_find_raster(opt.color_raster->answer, ""), &colors);
         Vect_write_colors(opt.output->answer, G_mapset(), &colors);
     }
 
-    if (z_raster && !Rast3d_close(z_raster))
-        Rast3d_fatal_error(_("Unable to close 3D raster map"));
-    if (color_raster && !Rast3d_close(color_raster))
-        Rast3d_fatal_error(_("Unable to close 3D raster map"));
+    if (z_raster >= 0)
+        Rast_close(z_raster);
+    if (color_raster >= 0)
+        Rast_close(color_raster);
 
     if (opt.vector_mask->answer) {
         VectorMask_destroy(&vector_mask);

Copied: grass-addons/grass7/raster/r.scatterplot/r.scatterplot.html (from rev 69601, grass-addons/grass7/raster3d/r3.scatterplot/r3.scatterplot.html)
===================================================================
--- grass-addons/grass7/raster/r.scatterplot/r.scatterplot.html	                        (rev 0)
+++ grass-addons/grass7/raster/r.scatterplot/r.scatterplot.html	2016-10-22 17:10:13 UTC (rev 69716)
@@ -0,0 +1,192 @@
+<h2>DESCRIPTION</h2>
+
+The <em>r.scatterplot</em> module takes raster maps and creates
+a scatter plot which is a vector map and where individual points in
+the scatter plot are vector points. As with any scatter plot the X
+coordinates of the points represent values from the first raster map
+and the Y coordinates represent values from the second raster map.
+Consequently, the vector map is placed in the combined value space of
+the original raster maps and its geographic position should be ignored.
+Typically, it is necessary to zoom or to change computational in order
+to view the scatter plot or to perform further computations on the result.
+
+<p>
+With the default settings, the <em>r.scatterplot</em> output allows
+measuring and querying of the values in the scatter plot. Settings
+such as <b>xscale</b> or <b>position</b> option change the coordinates
+and make some of the measurements wrong.
+
+
+<h3>Multiple variables</h3>
+
+If more than two raster maps are provided to the <b>input</b> option,
+<em>r.scatterplot</em> creates a scatter plot for each unique pair
+of input maps. For example, if A, B, C, and D are the inputs,
+<em>r.scatterplot</em> creates scatter plots for A and B, A and C,
+A and D, B and C, B and D, and finally C and D. Each pair is part of
+different vector map layer. <em>r.scatterplot</em> provides textual
+output which specifies the pairs and associated layers.
+
+<p>
+A 3D scatter plot can be generated when the <b>z_raster</b> option is
+provided. A third variable is added to each scatter plot and each point
+has Z coordinate which represents this third variable.
+
+<p>
+Each point can also have a color based on an additional variable
+based on the values from <b>color_raster</b>. Values from a raster are
+stored as categories, i.e. floating point values are truncated to
+integers, and a color table based on the input raster color table is
+assigned to the vector map.
+
+<p>
+The <b>z_raster</b> and <b>color_raster</b> can be the same. This can help
+with understanding the 3D scatter plot and makes the third variable
+visible in 2D as well.
+When <b>z_raster</b> and <b>color_raster</b> are the same, total of four
+variables are associated with one point.
+
+<center>
+<img src="r3_scatterplot_2_variables.png">
+<img src="r3_scatterplot_2_variables_3rd_color.png">
+<img src="r3_scatterplot_2_variables_3rd_z.png">
+<p><em>
+    Figure: One scatter plot of two variables (left),
+    the same scatter plot but with color showing third variable (middle),
+    again the same scatter plot in 3D where Z represents a third variable (right).
+</em></p>
+</center>
+
+<center>
+<img src="r3_scatterplot_2_variables_3rd_z_4th_color.png">
+<img src="r3_scatterplot_2_variables_3rd_z_4th_color2.png">
+<p><em>
+    Figure: One scatter plot in with one variable as Z coordinate and
+    another variable as color (two rotated views).
+</em></p>
+</center>
+
+
+<h3>Layout</h3>
+
+When working only with variable, X axis represents the first one
+and Y axis the second one. With more than one variable, the individual
+scatter plots for individual pairs of variables are at the same
+place. In this case, the coordinates show the actual values of the
+variables. Each scatter plot is placed into a separate layer of
+the output vector map.
+
+<center>
+<img src="r3_scatterplot_3_variables_3_colors_overlap.png">
+<p><em>
+    Figure: Three overlapping scatter plots of three variables A, B, and C.
+    Individual scatter plots are distinguished by color.
+    The colors can be obtained using <tt>d.vect layer=-1 -c</tt>.
+</em></p>
+</center>
+
+<p>
+If visualization is more important than preserving the actual values,
+the <b>-s</b> flag can be used. This will place the scatter plots next
+to each other separated by values provided using <b>spacing</b> option.
+
+<p>
+The layout options can be still combined with additional variables
+represented as Z coordinate or color. In that case, Z coordinate
+or color is same for all the scatter plots.
+
+<center>
+<img src="r3_scatterplot_3_variables_3_colors.png">
+<p><em>
+    Figure: Three scatter plots of three variables A, B, and C.
+    First one is A and B, second A and C, and third B and C.
+</em></p>
+</center>
+
+<center>
+<img src="r3_scatterplot_3_variables.png">
+<p><em>
+    Figure: Three scatter plots of three variables A, B, and C
+    with color showing a fourth variable D in all scatter plots.
+</em></p>
+</center>
+
+The options <b>xscale</b>, <b>yscale</b> and <b>zscale</b> will cause
+the values to be rescaled before they are stored as point coordinates.
+This is useful for visualization when one of the variables has
+significantly different range than the other or when the scatter plot
+is shown with other data and must fit a certain area.
+
+The <b>position</b> option is used to place the scatter plot to any
+given coordinates. Similarly, <b>-w</b> flag can be used to place it
+to the south-west corner of the computation region.
+
+
+<h2>NOTES</h2>
+
+<p>
+The resulting vector will have as many points as there is 3D raster
+cells in the current computational region. It might be appropriate to
+use coarser resolution for the scatter plot than for the other
+computations. However, note that the some values will be skipped
+which may lead, e.g. to missing some outliers.
+
+<p>
+The <b>color_raster</b> input is expected to be categorical raster
+or have values which won't loose anything when converted from floating
+point to integer. This is because vector categories are used to store
+the <b>color_raster</b> values and carry association with the color.
+
+<p>
+The visualization of the output vector map has potentially the same
+issue as visualization of any vector with many points. The points
+cover each other and above certain density of points, it is not possible
+to compare relative density in the scatter plot. Furthermore, if colors
+are associated with the points, the colors of points rendered last are
+those which are visible, not actually showing the prevailing color
+(value). The modules <em><a href="v.mkgrid.html">v.mkgrid</a></em> and
+<em><a href="v.vect.stats.html">v.vect.stats</a></em> can be used to
+overcome this issue.
+
+<h2>EXAMPLES</h2>
+
+<h3>Landsat bands</h3>
+
+Set the computation region to one of the raster maps:
+
+<div class="code"><pre>
+g.region raster=lsat7_2002_30
+</pre></div>
+
+Create the scatter plot:
+
+<div class="code"><pre>
+r.scatterplot input=lsat7_2002_30,lsat7_2002_40 output=scatterplot color_raster=landclass96
+</pre></div>
+
+<!--
+d.vect map=scatterplot color=none width=1 icon=basic/point
+d.legend -c raster=landclass96
+-->
+
+<center>
+<img src="r_scatterplot.png">
+<p><em>
+    Figure: Scatter plot showing third variable as color
+</em></p>
+</center>
+
+
+<h2>SEE ALSO</h2>
+
+<em>
+<a href="r.stats.html">r.stats</a>,
+<a href="d.correlate.html">d.correlate</a>,
+<a href="v.mkgrid.html">v.mkgrid</a>,
+<a href="v.vect.stats.html">v.vect.stats</a>,
+<a href="g.region.html">g.region</a>
+</em>
+
+<h2>AUTHOR</h2>
+
+Vaclav Petras, <a href="http://geospatial.ncsu.edu/osgeorel/">NCSU GeoForAll Lab</a>

Deleted: grass-addons/grass7/raster/r.scatterplot/r3.scatterplot.html
===================================================================
--- grass-addons/grass7/raster3d/r3.scatterplot/r3.scatterplot.html	2016-09-28 23:55:37 UTC (rev 69601)
+++ grass-addons/grass7/raster/r.scatterplot/r3.scatterplot.html	2016-10-22 17:10:13 UTC (rev 69716)
@@ -1,201 +0,0 @@
-<h2>DESCRIPTION</h2>
-
-The <em>r3.scatterplot</em> module takes 3D raster maps and creates
-a scatter plot which is a vector map and where individual points in
-the scatter plot are vector points. As with any scatter plot the X
-coordinates of the points represent values from the first raster map
-and the Y coordinates represent values from the second raster map.
-Consequently, the vector map is placed in the combined value space of
-the original raster maps and its geographic position should be ignored.
-Typically, it is necessary to zoom or to change computational in order
-to view the scatter plot or to perform further computations on the result.
-
-<p>
-With the default settings, the <em>r3.scatterplot</em> output allows
-measuring and querying of the values in the scatter plot. Settings
-such as <b>xscale</b> or <b>position</b> option change the coordinates
-and make some of the measurements wrong.
-
-
-<h3>Multiple variables</h3>
-
-If more than two raster maps are provided to the <b>input</b> option,
-<em>r3.scatterplot</em> creates a scatter plot for each unique pair
-of input maps. For example, if A, B, C, and D are the inputs,
-<em>r3.scatterplot</em> creates scatter plots for A and B, A and C,
-A and D, B and C, B and D, and finally C and D. Each pair is part of
-different vector map layer. <em>r3.scatterplot</em> provides textual
-output which specifies the pairs and associated layers.
-
-<p>
-A 3D scatter plot can be generated when the <b>z_raster</b> option is
-provided. A third variable is added to each scatter plot and each point
-has Z coordinate which represents this third variable.
-
-<p>
-Each point can also have a color based on an additional variable
-based on the values from <b>color_raster</b>. Values from a raster are
-stored as categories, i.e. floating point values are truncated to
-integers, and a color table based on the input raster color table is
-assigned to the vector map.
-
-<p>
-The <b>z_raster</b> and <b>color_raster</b> can be the same. This can help
-with understanding the 3D scatter plot and makes the third variable
-visible in 2D as well.
-When <b>z_raster</b> and <b>color_raster</b> are the same, total of four
-variables are associated with one point.
-
-<center>
-<img src="r3_scatterplot_2_variables.png">
-<img src="r3_scatterplot_2_variables_3rd_color.png">
-<img src="r3_scatterplot_2_variables_3rd_z.png">
-<p><em>
-    Figure: One scatter plot of two variables (left),
-    the same scatter plot but with color showing third variable (middle),
-    again the same scatter plot in 3D where Z represents a third variable (right).
-</em></p>
-</center>
-
-<center>
-<img src="r3_scatterplot_2_variables_3rd_z_4th_color.png">
-<img src="r3_scatterplot_2_variables_3rd_z_4th_color2.png">
-<p><em>
-    Figure: One scatter plot in with one variable as Z coordinate and
-    another variable as color (two rotated views).
-</em></p>
-</center>
-
-
-<h3>Layout</h3>
-
-When working only with variable, X axis represents the first one
-and Y axis the second one. With more than one variable, the individual
-scatter plots for individual pairs of variables are at the same
-place. In this case, the coordinates show the actual values of the
-variables. Each scatter plot is placed into a separate layer of
-the output vector map.
-
-<center>
-<img src="r3_scatterplot_3_variables_3_colors_overlap.png">
-<p><em>
-    Figure: Three overlapping scatter plots of three variables A, B, and C.
-    Individual scatter plots are distinguished by color.
-    The colors can be obtained using <tt>d.vect layer=-1 -c</tt>.
-</em></p>
-</center>
-
-<p>
-If visualization is more important than preserving the actual values,
-the <b>-s</b> flag can be used. This will place the scatter plots next
-to each other separated by values provided using <b>spacing</b> option.
-
-<p>
-The layout options can be still combined with additional variables
-represented as Z coordinate or color. In that case, Z coordinate
-or color is same for all the scatter plots.
-
-<center>
-<img src="r3_scatterplot_3_variables_3_colors.png">
-<p><em>
-    Figure: Three scatter plots of three variables A, B, and C.
-    First one is A and B, second A and C, and third B and C.
-</em></p>
-</center>
-
-<center>
-<img src="r3_scatterplot_3_variables.png">
-<p><em>
-    Figure: Three scatter plots of three variables A, B, and C
-    with color showing a fourth variable D in all scatter plots.
-</em></p>
-</center>
-
-The options <b>xscale</b>, <b>yscale</b> and <b>zscale</b> will cause
-the values to be rescaled before they are stored as point coordinates.
-This is useful for visualization when one of the variables has
-significantly different range than the other or when the scatter plot
-is shown with other data and must fit a certain area.
-
-The <b>position</b> option is used to place the scatter plot to any
-given coordinates. Similarly, <b>-w</b> flag can be used to place it
-to the south-west corner of the computation region.
-
-
-<h2>NOTES</h2>
-
-<p>
-The resulting vector will have as many points as there is 3D raster
-cells in the current computational region. It might be appropriate to
-use coarser resolution for the scatter plot than for the other
-computations. However, note that the some values will be skipped
-which may lead, e.g. to missing some outliers.
-
-<p>
-The <b>color_raster</b> input is expected to be categorical raster
-or have values which won't loose anything when converted from floating
-point to integer. This is because vector categories are used to store
-the <b>color_raster</b> values and carry association with the color.
-
-<p>
-The visualization of the output vector map has potentially the same
-issue as visualization of any vector with many points. The points
-cover each other and above certain density of points, it is not possible
-to compare relative density in the scatter plot. Furthermore, if colors
-are associated with the points, the colors of points rendered last are
-those which are visible, not actually showing the prevailing color
-(value). The modules <em><a href="v.mkgrid.html">v.mkgrid</a></em> and
-<em><a href="v.vect.stats.html">v.vect.stats</a></em> can be used to
-overcome this issue.
-
-<h2>EXAMPLES</h2>
-
-<h3>Example with generated data</h3>
-
-Set the computational region for generating data and subsequent
-analysis:
-
-<div class="code"><pre>
-g.region s=0 n=100 w=0 e=100 b=0 t=50 res=10 res3=10 tbres=1 -p3
-</pre></div>
-
-Generate data using raster algebra:
-
-<div class="code"><pre>
-r3.mapcalc "A = if(depth() < ndepths()/ 2,  row()+col()+depth(), col())" -s
-r3.mapcalc "B = if(row() < nrows()/2, rand(0, nrows()) + col() + depth(), depth() + rand(0, nrows()))" -s
-r3.mapcalc "C = if(col() < ncols()/3, row() + depth(), rand(0, ncols()))" -s
-r3.mapcalc "D = depth()"
-</pre></div>
-
-Create a scatter plot of correlations between A and B.
-Use C for the Z axes (height) and D for the color.
-
-<div class="code"><pre>
-r3.scatterplot input=A,B output=scatterplot z_raster=C color_raster=D
-</pre></div>
-
-<center>
-<img src="r3_scatterplot_2d.png">
-<img src="r3_scatterplot.png">
-<p><em>
-    Figure: 2D scatter plot showing third variable as color
-    and 3D scatter plot showing third variable as color and fourth variable on Z axis
-    which uncovers another group of values not visible from the 2D scatter plot
-</em></p>
-</center>
-
-
-<h2>SEE ALSO</h2>
-
-<em>
-<a href="r3.stats.html">r3.stats</a>,
-<a href="d.correlate.html">d.correlate</a>,
-<a href="v.mkgrid.html">v.mkgrid</a>,
-<a href="v.vect.stats.html">v.vect.stats</a>,
-<a href="g.region.html">g.region</a>
-</em>
-
-<h2>AUTHOR</h2>
-
-Vaclav Petras, <a href="http://geospatial.ncsu.edu/osgeorel/">NCSU GeoForAll Lab</a>

Deleted: grass-addons/grass7/raster/r.scatterplot/r3_scatterplot.png
===================================================================
(Binary files differ)

Deleted: grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_2_variables.png
===================================================================
(Binary files differ)

Deleted: grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_2_variables_3rd_color.png
===================================================================
(Binary files differ)

Deleted: grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_2_variables_3rd_z.png
===================================================================
(Binary files differ)

Deleted: grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_2_variables_3rd_z_4th_color.png
===================================================================
(Binary files differ)

Deleted: grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_2_variables_3rd_z_4th_color2.png
===================================================================
(Binary files differ)

Deleted: grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_2d.png
===================================================================
(Binary files differ)

Deleted: grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_3_variables.png
===================================================================
(Binary files differ)

Deleted: grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_3_variables_3_colors.png
===================================================================
(Binary files differ)

Deleted: grass-addons/grass7/raster/r.scatterplot/r3_scatterplot_3_variables_3_colors_overlap.png
===================================================================
(Binary files differ)

Added: grass-addons/grass7/raster/r.scatterplot/r_scatterplot.png
===================================================================
(Binary files differ)


Property changes on: grass-addons/grass7/raster/r.scatterplot/r_scatterplot.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream



More information about the grass-commit mailing list