如何找到轮廓图并以90个百分点突出显示?
我有一个光栅图像,其值范围为 1 到 10。 我想找到我的栅格数据的 90%。并且需要通过突出显示具有 90 百分位数的区域来找到等高线图。我想要我的栅格数据图附在下面。我正在 R 中进行分析。
library(raster)
library(cartography)
library(sf)
library(SpatialPosition)
r <- raster("E:/data.tif", package="raster")
plot(r)
contour(r, add=TRUE)
我得到了这种类型的图像,但我想要带有阴影的图像(右侧)。非常感谢您帮助制作这张照片。
I have a raster image whose value ranges from 1 to 10.
I want to find the 90 percentile of mine raster data. And need to find the contour graph by highlighting the area having the 90 percentile. I want a figure for my raster data is attached below. I am doing my analysis in R.
library(raster)
library(cartography)
library(sf)
library(SpatialPosition)
r <- raster("E:/data.tif", package="raster")
plot(r)
contour(r, add=TRUE)
I got this type of image, but I wants the one with a shaded one (right side). Help on making this picture will be much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
显然,没有您的数据,但是我们可以制作这样的示例栅格:
从现在开始,以下代码也应该与您自己的栅格一起使用。我们可以这样的数据中的第90世纪:
现在,让我们将光栅转换为X,Y,Z数据框架:
我们可以使用功能丰富的
ggplot2
库来绘制数据。我们将绘制为填充的轮廓图,并在我们的第90世纪添加鲜艳的绿色轮廓:Obviously, don't have your data, but we can make an example raster like this:
From now on, the following code should work with your own raster too. We can get the 90th centile of our data like this:
Now let's convert the raster to an x, y, z data frame:
We can use the feature-rich
ggplot2
library for drawing the data. We will plot as a filled contour map and add a bright green contour at our 90th centile: