library(raster)
library(rasterVis)
r <- raster(nrows=10, ncols=10)
r <- setValues(r, 1:ncell(r))
levelplot(r)
I want to put a word (a text) that is "Original map" under the xlab "Longitude"
Is this possible?
library(raster)
library(rasterVis)
r <- raster(nrows=10, ncols=10)
r <- setValues(r, 1:ncell(r))
levelplot(r)
I want to put a word (a text) that is "Original map" under the xlab "Longitude"
Is this possible?
This is a manual solution, but you can use mtext
to place text around margins with line
and adj
parameters to put it where you want (or text
).
plot.new() # open new plot
r <- raster(nrows=10, ncols=10)
r <- setValues(r, 1:ncell(r))
levelplot(r)
mtext("Original map", 1, line=-3.4, adj=0.4)
With the grid library you can place text, as well.
plot.new() # open new plot
r <- raster(nrows=10, ncols=10)
r <- setValues(r, 1:ncell(r))
levelplot(r)
library(grid)
trellis.focus("panel", 1, 1, clip.off = TRUE,highlight=TRUE)
grid.text("Hello World!", x = 0.5, y = 0.5,gp = gpar(fontsize = 6))
trellis.unfocus()