R - 轮廓图 [英] R - Contour map

查看:601
本文介绍了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 ...

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)
fill.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)




因为大部分的co rrelations接近0,很难看到大的。


  1. 我可以更容易看到,还是我可以更改分辨率,以便我可以放大吗?在这一刻,轮廓太紧,所以我看不到轮廓水平。


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


  3. 有人可以告诉我如何绘制一个特定的区域地图,喜欢经度从100到160,纬度从-50到-80?我试图替换 lon_sst lat_sst ,但它有一个维度错误。谢谢。



解决方案

要回答看起来是一样的1和3请求,尝试:

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

寻址2:您的范围比[-1,1]小得多。这些轮廓线上的标签是数字,如.06,-.02和.02。 轮廓函数将接受nlevels或levels参数。一旦你有一个爆炸部分,你可以用它来调整轮廓的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天全站免登陆