Learn R Programming

rworldmap (version 1.01)

mapGriddedData: Produce maps of global gridded data at half degree resolution

Description

Produce maps of global gridded data at half degree resolution

Usage

mapGriddedData(  dataset =          ""
               , nameColumnToPlot = "" 
               , numCats =          5  
               , catMethod =        "quantiles"   
               , colourPalette =    "heat"  
               , xlim =             c(-180,180)
               , ylim =             c(-80,90) 
               , mapRegion =        "world"   
               , addLegend =        TRUE
               , addBorders =       'low' 
               , borderCol =        'grey'
               , oceanCol =         NA
               , landCol =          NA
               , plotData =         TRUE
               , aspect =           1   
               )

Arguments

dataset
gridded data either as a :
SpatialGridDataFrame (R object defined in package sp) file name of a GridAscii file - this is an Esri format 2D R matrix or array (rows by

Value

  • invisibly returns a list containing the data and main options used for the map, the list can be passed to addMapLegend along with additional options to allow greater flexibility in legend creation.

item

  • nameColumnToPlot
  • numCats
  • catMethod
  • colourPalette
  • xlim
  • ylim
  • mapRegion
  • addLegend
  • addBorders
  • borderCol
  • oceanCol
  • landCol
  • plotData
  • aspect

enumerate

Details

Plots a map of global half degree gridded data, allowing classification, colours and regions to be set. Certain catMethod and colourPalette options go well together. e.g. "diverging" and "diverging", "categorical" and "rainbow"

See Also

classInt, RColorBrewer

Examples

Run this code
## mapping continuous data
data(gridExData,envir=environment(),package="rworldmap")
gridExData <- get("gridExData")
mapGriddedData(gridExData)

## reclassing continuous data to categorical & mapping
data(gridExData,envir=environment(),package="rworldmap")
#find quartile breaks
cutVector <- quantile(gridExData@data[,1],na.rm=TRUE)
#classify the data to a factor
gridExData@data$categories <- cut( gridExData@data[,1]
                                      , cutVector, include.lowest=TRUE)
#rename the categories
levels(gridExData@data$categories) <- c('low', 'med', 'high', 'vhigh')
#mapping
mapGriddedData( gridExData, nameColumnToPlot= 'categories'
              , catMethod='categorical')

Run the code above in your browser using DataLab