enlarge_raster {plothelper} | R Documentation |
Enlarge a Color Matrix
Description
This is a convenient wrapper of
colorRampPalette
to enlarge
a color matrix or raster.
Usage
enlarge_raster(x, n = c(10, 10), row_first = TRUE, space = "rgb")
Arguments
x |
a color matrix or raster. It should have at least 1 row and 1 column with no NAs. |
n |
a vector with 2 numbers. If it has 1 number,
the number will be repeated twice. The two numbers
indicate how many colors you will get in the result per
row and per column. Default is |
row_first |
enlarge rows first or enlarge columns first? Default is TRUE. The results are almost the same, so you do not need to change this. |
space |
the |
Examples
library(ggplot2)
# the original matrix
m=matrix(c(
"red", "yellow", "green",
"blue", "purple", "cyan",
"black", "orange", "grey"), byrow=TRUE, nrow=3)
# enlarge the matrix
mm=enlarge_raster(m, c(15, 15), space="Lab")
ggplot()+xlim(0, 10)+ylim(0, 5)+coord_fixed()+
annotation_raster(mm,
xmin=0, xmax=10, ymin=0, ymax=5, interpolate=TRUE)
[Package plothelper version 0.1.9 Index]