Description Usage Arguments Details Value Author(s) References See Also Examples
Displays a grid-like colored image using color values from a GIS color palette.
1 |
x |
A grid-like data object, including matrix, data frame, or SpatialGridDataFrame. |
pal |
A GIS palette. |
attr |
If x is a SpatialGridDataFrame, can specify which value to use by position or name. |
plot |
If FALSE, the image is not displayed. |
legend |
If TRUE, a legend is added to the plot. |
... |
Other arguments to be passed to |
This function enables the use of color palettes from GRASS GIS to display GIS images
within R.
A percentage-based palette is automatically expanded to match the range of values in
x
. If a different range is desired, gis.pal
can be used to set
up the palette before plotting.
The binned dataset matching the levels of the palette is returned invisibly.
Sarah Goslee
The palettes included are adapted from the GRASS 7.0 color tables https://grasswiki.osgeo.org/wiki/Color_tableshttps://grasswiki.osgeo.org/wiki/Color_tables.
codeimage, codegis.pal, codegis.pal.info,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | # generate sample data
mat1 <- matrix(runif(100), 10, 10)
# expand an included GIS palette to 11 colors
pal1 <- gis.pal("gyr", n=11, zlim=c(0,1))
pal1
# display the image and a color ramp
## Not run:
layout(matrix(c(1,1,1,2), ncol=1))
gisimage(mat1, pal1, legend=FALSE)
display.gis.pal(pal=pal1)
## End(Not run)
# create a new palette
# note that palettes do not have to be regular
pal2 <- read.gis.pal(text = "
0 black
10
20
100
")
## Not run:
layout(matrix(c(1,1,1,2), ncol=1))
# A percentage-based palette is automatically expanded.
gisimage(mat1, pal2, legend=FALSE)
display.gis.pal(pal=pal2)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.