Changes between Version 2 and Version 3 of udg/ecoms/RPackage/examples/continentalSelection


Ignore:
Timestamp:
Feb 20, 2014 2:27:15 PM (8 years ago)
Author:
juaco
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • udg/ecoms/RPackage/examples/continentalSelection

    v2 v3  
    1010Plotting objects inheriting from this class or related classes (e.g. `SpatialGridDataFrame`) is straightforward using the `spplot` methods, as described in [wiki:../Trellis the previous example], but it is not directly usable as input for other plotting methods in R.
    1111Next, we present some typical plotting functions and how to extract the spatial coordinates in a suitable format for plotting.
     12
     13The total precipitation field is calculated as the total accumulated precipitation during the selected period for each model grid cell:
     14
     15{{{
     16tp <- colSums(monsoon$MemberData$Member_16)
     17}}}
     18
     19And this is the classical way of displaying the data using the `spplot` method:
     20
     21{{{
     22sgdf <- SpatialGridDataFrame(monsoon$LonLatCoords, as.data.frame(tp))
     23data(world_map)
     24wl <- as(world_map, "SpatialLines")
     25wlines <- list("sp.lines", wl)
     26spplot(sgdf, scales = list(draw = TRUE), sp.layout = list(wlines), col.regions = rev(topo.colors(41)))
     27}}}
     28
     29[[Image(spplot.png)]]
     30
     31It is also straightforward to represent the precipitation using contour lines:
     32
     33{{{
     34spplot(sgdf, scales = list(draw = TRUE), contour = TRUE, col = "red", col.regions = rev(topo.colors(41)))
     35}}}
     36
     37[[Image(spplot_contour.png)]]
     38
     39
     40
     41