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

前端 未结 5 1056
陌清茗
陌清茗 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:21

    Thanks for the answers guys! It also helped me to find more information on the subject. I learned that I can control the scales of gray using for example the following:

    levelplot(my_var, col.regions = gray(0:100/100))
    

    which gives me 100 shades of gray from black (0) to white (1).

    I'm using the function to plot gray scale images (photos) which I've pre-processed to a double matrix. I don't know if it's the best possible approach, but so far it works and I believe it gives me more options for graphing than the basic displaying options in the EBImage and rimage libraries. I don't know how I'd alter the palette to match displaying color images, but I'm glad I didn't have to do that so far...

提交回复
热议问题