R语言学习记录:rasterVis包绘制栅格调整colorkey
1.可以选择不绘制colorkey(默认也是F)
2.可以选择绘制默认colorkey
3.自定义设置colorkey
自己翻译一下:
由于rasterVis包是基于lattice的,所以colorkey的参数和lattice一样,(具体细节可以看lattice包的levelplot函数的解释)。
此外,在rasterVis包的levelplot函数添加了一个在lattice包的levelplot函数没有的特点,rasterVis包的levelplot函数可以添加title参数(character),还有title.gpar参数(list)(具体细节看gpar,应用于标题文本)。

OK,现在再去找lattice的文档找一下levelplot里面的colorkey的解释

space:上下左右
xy:位置参数,已经弃用
col:颜色渐变规范,和level.colors函数的col.regions参数一样
at:数值向量。指定在哪颜色开始变化,必须必颜色向量大1
tri.lower, tri.upper:逻辑或数值,控制colorbar的形状的两段是否是三角形还是矩形。对于默认值(NA),只有当相应的极端值分别为-Inf或Inf,并且三角形占总长度的5%时,才会发生这种情况。如果是数字和在0到0.25之间,则给出相应的分数,当指定为TRUE时,同样为5%。
labels:用于标记at值的字符向量。或者更常见的是描述标签特征的列表。此列表可能包括组件标签、at、cex、col、rot、font、fontface和fontfamily
title:通常是字符向量,或者是表达式,或者是控制详细信息的list,或者是一个任意的grob(grid graphical objects)。list的详细解释请参见For details of how the list form is interpreted, see the entry for main in xyplot。
generally speaking, the actual label should be specifified as the label component (which may be unnamed if it is the fifirst component), and the remaining arguments are used as appropriate in a call to textGrob.
一般来说,实际的标签应该指定为标签组件(如果它是第一个组件,则可能未命名),其余的参数在对textGrob的调用中适当使用。
Further control of the placement of the title is possible through the component title.control. In particular, if a rot component is not specifified, its default depends on the value of title.control$side (0 for top or bottom, and 90 for left or right).
通过title.control,可以进一步控制标题的位置。特别地,如果未指定rot(逆时针旋转角度)组件,其默认值取决于title.control中side的值
title(我也不知道为什么会有两个title component):A list providing control over the placement of a title, if specifified. Currently two components are honoured: side can take values "top", "bottom", "left", and "right", and specififies the side of the colorkey on which the title is to be placed. Defaults to the value of the "space" component. padding is a multiplier for the default amount of padding between the title and the colorkey.
如果指定的话,它是一个列表,这个列表控制colorkey标题位置。目前有两个component,side=上下左右,并且side还指定colorkey的标题在colorkey的哪一边。默认值和space component的值一样。(最后一句我不知道怎么翻译,机翻的话就是:填充是标题和colorkey之间的默认填充量的乘积)(这段话我理解的是两个component分别是side和padding,但是这俩我都试了,不报错也没反应)
tick.number:The approximate number of ticks desired。所需的大致tick数目(我不明白为什么会用“大约”来描述)tick是刻度的意思
tck:A (scalar) multipler for tick lengths.刻度长度
corner:与xy交互,尚未实现
width:colorkey的宽度
height:The length of key as a fraction of the appropriate side of plot. colorkey的长度作为图的适当部分的一部分。
raster:A logical flag indicating whether the colorkey should be rendered as a raster image using grid.raster. See also panel.levelplot.raster.一个逻辑标志,指示colorkey是否应该使用grid.raster渲染为光栅图像。另请参见panel.levelplot.raster。
interpolate: Logical flag, passed to rasterGrob when raster=TRUE.
axis.line: A list giving graphical parameters for the color key boundary and tick marks. Defaults to trellis.par.get("axis.line").
axis.text: A list giving graphical parameters for the tick mark labels on the color key. Defaults to trellis.par.get("axis.text").

现在再去找xyplot里面的main参数的解释

总结:真rlnm了!就搁这无穷套娃呗,写个解释文档跟要了你命似的,参见这个参见那个的,rnm!