getSpatialMap_mat {hyfo}R Documentation

Replot raster matrix

Description

replot the matrix output from getSpatialMap, when output = 'data' or output is default value.

Usage

getSpatialMap_mat(
  matrix,
  title_d = NULL,
  catchment = NULL,
  point = NULL,
  output = "data",
  name = NULL,
  info = FALSE,
  scale = "identity",
  color = NULL,
  ...
)

Arguments

matrix

A matrix raster, should be the result of getSpatialMap(), output should be default or 'data'

title_d

A string showing the title of the plot, defaut is NULL.

catchment

A catchment file geting from shp2cat() in the package, if a catchment is available for background.

point

A dataframe, showing other information, e.g., location of the gauging stations. The the data.frame should be with columes "name, lon, lat, z, value".

output

A string showing the type of the output, if output = 'ggplot', the returned data can be used in ggplot and getSpatialMap_comb(); if output = 'plot', the returned data is the plot containing all layers' information, and can be plot directly or used in grid.arrange; if not set, the raster matrix data will be returned.

name

If output = 'ggplot', name has to be assigned to your output, in order to differentiate different outputs in the later multiplot using getSpatialMap_comb.

info

A boolean showing whether the information of the map, e.g., max, mean ..., default is FALSE.

scale

A string showing the plot scale, 'identity' or 'sqrt'.

color

Most of time you don't have to set this, but if you are not satisfied with the default color, you can set your own palette here. e.g., color = c('red', 'blue'), then the value from lowest to highest, will have the color from red to blue. More info about color, please check ?palette().

...

title, x, y showing the title and x and y axis of the plot. e.g. title = 'aaa' default is about precipitation.

Value

A matrix representing the raster map is returned, and the map is plotted.

References

Examples


## Not run: 
data(tgridData)# the result of \code{loadNcdf}
#the output type of has to be default or 'data'.
a1 <- getSpatialMap(tgridData, method = 'mean')
a2 <- getSpatialMap(tgridData, method = 'max')
a3 <- getSpatialMap(tgridData, method = 'winter')
a4 <- getSpatialMap(tgridData, method = 'summer')
#For example, if we want to investigate the difference between mean value and max.

a5 <- a2 - a1
getSpatialMap_mat(a4)

#Or to investigate the difference between winter value and summer value.
a6 <- a3 - a4
getSpatialMap_mat(a6)


## End(Not run)


# More examples can be found in the user manual on https://yuanchao-xu.github.io/hyfo/


[Package hyfo version 1.4.6 Index]