的R - 等高线图 [英] R - Contour map

查看:959
本文介绍了的R - 等高线图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经绘制等高线图,但我需要做一些改进。这是所使用的数据的结构:

 > STR(lon_sst)
 NUM [1:360(1D)-179.5 -178.5 -177.5 -176.5 -175.5 ...> STR(lat_sst)
 NUM [1:180(1D)-89.5 -88.5 -87.5 -86.5 -85.5 -84.5 -83.5 -82.5 -81.5 -80.5 ...>暗淡(cor_Houlgrave_SF_SST_JJA_try)
[1] 360 180需要(图)
地图::地图(数据库=世界,填写= TRUE,列=淡蓝色)
地图:: map.axes()
轮廓(X = lon_sst,Y = lat_sst,Z = cor_Houlgrave_SF_SST_JJA_try [C(181:360,1:180),],zlim = C(1,1),加= TRUE)
帕(问= TRUE)
filled.contour(X = lon_sst,Y = lat_sst,Z = cor_Houlgrave_SF_SST_JJA_try [C(181:360,1:180),],zlim = C(1,1),color.palette = heat.colors)


由于大多数的相关性是接近0时,它是很难看到的大的。


  1. 我可以更容易地看到,或者我可以更改分辨率,所以我可以放大吗?目前的轮廓过于紧密间隔,所以我什么也看不见轮廓水平。


  2. 我在哪里可以看到增量,设置我的范围内(-1,1),我不知道如何手动设置的时间间隔。


  3. 有人能告诉我如何绘制地图的特定区域,如从100经度160,纬度-50〜-80?我试图取代 lon_sst lat_sst ,但它有一个尺寸误差。谢谢你。



解决方案

要回答1和3这似乎是相同的请求,请尝试:

  ::映射图(数据库=世界,填写= TRUE,列=浅蓝
                            ylim = C(-80,-50),XLIM = C(100160))

要解决2:你有一个更小范围比[-1,1]。这些轮廓线的标签,就像0.06,-.02和0.02号码。在轮廓函数将接受一个NLEVELS或水平的说法。一旦你有一个被炸毁部分,您可以用它来调整Z-分辨率的轮廓。

I have plotted a contour map but i need to make some improvements. This is the structure of the data that are used:

> str(lon_sst)
 num [1:360(1d)] -179.5 -178.5 -177.5 -176.5 -175.5 ...

> str(lat_sst)
 num [1:180(1d)] -89.5 -88.5 -87.5 -86.5 -85.5 -84.5 -83.5 -82.5 -81.5 -80.5 ...

> dim(cor_Houlgrave_SF_SST_JJA_try)
[1] 360 180

require(maps)
maps::map(database="world", fill=TRUE, col="light blue")
maps::map.axes()
contour(x=lon_sst, y=lat_sst, z=cor_Houlgrave_SF_SST_JJA_try[c(181:360, 1:180),], zlim=c(-1,1), add=TRUE)
par(ask=TRUE)
filled.contour(x = lon_sst, y=lat_sst, z=cor_Houlgrave_SF_SST_JJA_try[c(181:360, 1:180),],zlim=c(-1,1), color.palette=heat.colors)

Because most of the correlations are close to 0, it is very hard to see the big ones.

  1. Can i make it easier to see, or can i change the resolution so i can zoom it in? At the moment the contours are too tightly spaced so I can't see what the contour levels were.

  2. Where can i see the increment, i set my range as (-1,1), i don't know how to set the interval manually.

  3. Can someone tell me how to plot a specific region of the map, like longitude from 100 to 160 and latitude from -50 to -80? I have tried to replace lon_sst and lat_sst, but it has a dimension error. Thanks.

解决方案

To answer 1 and 3 which appear to be the same request, try:

maps::map(database="world", fill=TRUE, col="light blue", 
                            ylim=c(-80, -50), xlim=c(100,160) )

To address 2: You have a much smaller range than [-1,1]. The labels on those contour lines are numbers like .06, -.02 and .02. The contour function will accept either an 'nlevels' or a 'levels' argument. Once you have a blown up section you can use that to adjust the z-resolution of contours.

这篇关于的R - 等高线图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆