5

Does any know how to change the line width of a levelplot graphic, especially that with multiple panels? The box line width should change alongside the tick marks. In base R one can use plot(x);box(lwd=10).

Is this possible within levelplot?

Many thanks.

library(rasterVis)
mycolors=c("darkred","red3", "orange", "yellow", "lightskyblue", 
          "royalblue3","darkblue")
s <- stack(replicate(6, raster(matrix(runif(100), 10))))
levelplot(s, layout=c(3, 2), col.regions=mycolors, index.cond=list(c(1, 3, 5, 2, 4, 6)))
eipi10
  • 91,525
  • 24
  • 209
  • 285
code123
  • 2,082
  • 4
  • 30
  • 53

1 Answers1

3

You can set the border line widths with the par.settings argument. For example:

levelplot(s, layout=c(3, 2), col.regions=mycolors, 
          index.cond=list(c(1, 3, 5, 2, 4, 6)), 
          par.settings=list(axis.line=list(lwd=3), strip.border=list(lwd=3)))

enter image description here

eipi10
  • 91,525
  • 24
  • 209
  • 285
  • Great answer! This makes my plot look better after exporting in high resolution using the Cairo package. – code123 Jan 23 '16 at 03:46
  • 1
    You will get a better color key if you define a new theme with `rasterTheme` instead of using `col.regions`. Thus, `myTheme <- rasterTheme(region = mycolors)` and `myTheme <- modifyList(myTheme, list(axis.line=list(lwd=3), strip.border=list(lwd=3)))`. Finally, assign this `myTheme` list to `par.settings`. – Oscar Perpiñán Jan 30 '16 at 13:22