R: how to change lattice (levelplot) color theme?

前端 未结 5 1129
陌清茗
陌清茗 2021-01-31 20:30

The default theme on my installation is something which maps the values to pink and cyan. How to change it for example to a gray scale theme?

5条回答
  •  無奈伤痛
    2021-01-31 21:02

    You may also want to consider using panel.levelplot.raster, as it reduces the figure size sizably, as I recently found out. Combining this tip with changing trellis settings in general, here are a following examples:

    trellis.par.set(regions=list(col=topo.colors(100)))
    levelplot(volcano, panel = panel.levelplot.raster)
    
    levelplot(volcano, panel = panel.levelplot.raster,
              par.settings=list(regions=list(col=topo.colors(100))))
    

    The second method is deceptive because the trellis settings are in fact being changed globally. I didn't know about the col.regions argument though - that's pretty nice as it seems to change the color theme locally.

提交回复
热议问题