R - 等高线图

发布于 2025-01-03 03:36:28 字数 376 浏览 3 评论 0原文

我有一个等高线图,我想知道是否可以标记各个等高线级别以及颜色? (也就是说,第一个粉红色轮廓是 0.2,第二个是 0.4 或任何有效的值)。

另外,将土地填充为纯色的论据是什么?

library(lattice)
contourplot(cor_Warra_SF_SST_SON, region=TRUE, at=seq(-1, 1, 0.2), 
labels=FALSE, row.values=lon_sst, column.values=lat_sst,
xlab='longitude', ylab='latitude')

在此处输入图像描述

I have a contour plot, I am wondering is it possible to label the individual contour levels as well as the colours? (i.e. say the first pink contour is 0.2, second is 0.4 or whatever works).

Also, what is the argument for filling land as a solid color?

library(lattice)
contourplot(cor_Warra_SF_SST_SON, region=TRUE, at=seq(-1, 1, 0.2), 
labels=FALSE, row.values=lon_sst, column.values=lat_sst,
xlab='longitude', ylab='latitude')

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我恋#小黄人 2025-01-10 03:36:28

要包含等高线的标签,只需设置 labels = TRUE(代替您当前使用的 labels=FALSE)。

?contourplot 记录了 labels 参数:

标签:通常是一个逻辑,指示等高线是否应该
被标记,但其他更复杂的可能性
控制存在。详细信息记录在帮助页面中
'panel.levelplot',此参数传递给它
不变。该帮助页面还记录了“label.style”
参数,它影响标签的呈现方式。

要为大陆添加填充多边形,我尝试使用 latticeExtra 包中的 mapplot(),将其添加到您已经使用 layer 生成的绘图中(),也来自 latticeExtra。 (如果无法访问您正在使用的数据,我无法获得比这更具体的信息。)

To include labels for the contour lines, simply set labels = TRUE (in place of the labels=FALSE that you are currently using).

?contourplot document the labels argument thusly:

labels: typically a logical indicating whether contour lines should
be labelled, but other possibilities for more sophisticated
control exists. Details are documented in the help page for
‘panel.levelplot’, to which this argument is passed on
unchanged. That help page also documents the ‘label.style’
argument, which affects how the labels are rendered.

To add filled polygons for the continents, I'd try using mapplot() from the latticeExtra package, adding it to the plot you're already produced using layer(), also from latticeExtra. (I can't get much more specific than that without having access to the data you are using.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文