[英]R raster plot legend labels not aligning to breaks
This one is driving me crazy and I can't seem to hone in on it.这个让我发疯,我似乎无法磨练它。 Maybe someone else has had this issue.
也许其他人有这个问题。 I am plotting a raster and plotting its legend separately.
我正在绘制一个光栅并分别绘制它的图例。 The legend axis labels will not exactly align with the breaks in the legend and it's driving me nuts.
图例轴标签不会与图例中的中断完全对齐,这让我发疯。 Below are is the code I call, plus all of the input variables, and then a screenshot of what's happening.
下面是我调用的代码,加上所有输入变量,然后是正在发生的事情的屏幕截图。
Legend Call传奇召唤
plot(lzreate,
col=qcol,
legend.only=TRUE,
legend.shrink=1,
legend.width=2.5,
breaks=ltq,
axis.args=list(at=ltq,
labels=round(zp,2),
fg=txtcol,
col.axis=txtcol))
Raster Object光栅对象
>lzreate
class : RasterLayer
dimensions : 2647, 3900, 10323300 (nrow, ncol, ncell)
resolution : 3333, 3333 (x, y)
extent : -7332781, 5665919, -4372829, 4449622 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=aea +lat_1=20 +lat_2=60 +lat_0=40 +lon_0=-96 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs +towgs84=0,0,0
data source : in memory
names : layer
values : -3.490627, 0.7254335 (min, max)
Colors颜色
>length(qcol)
[1] 24
>qcol
[1] "#0A0A0A" "#1F1209" "#341B08" "#492407" "#5F2D06" "#743605" "#893F04"
[8] "#9F4803" "#B45103" "#C95A02" "#DF6301" "#F46C00" "#FF770B" "#FF8321"
[15] "#FF8F37" "#FF9C4D" "#FFA863" "#FFB479" "#FFC190" "#FFCDA6" "#FFD9BC"
[22] "#FFE6D2" "#FFF2E8" "#FFFFFF"
Zlim兹利姆
>lzl
[1] -3.536184 1.896070
Breaks休息时间
> length(ltq)
[1] 25
> ltq
[1] -3.53618385 -2.70255423 -2.38880472 -2.07505520 -1.91818045 -1.76130569
[7] -1.60443093 -1.44755617 -1.29068142 -1.13380666 -0.97693190 -0.89849452
[13] -0.82005714 -0.74161977 -0.66318239 -0.50630763 -0.34943287 -0.19255811
[19] -0.03568336 0.12119140 0.27806616 0.43494092 0.74869043 1.06243995
[25] 1.89606956
Labels标签
> length(zp)
[1] 25
> round(zp,2)
[1] 0.00 0.07 0.09 0.13 0.15 0.17 0.20 0.24 0.28 0.32 0.38 0.41 0.44 0.48 0.52
[16] 0.60 0.71 0.82 0.96 1.13 1.32 1.54 2.11 2.89 6.66
Result结果
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.