NJUYJX的个人博客分享 http://blog.sciencenet.cn/u/NJUYJX

博文

R语言sp包学习笔记(2)——Chapter3 Visualizing Spatial Data

已有 8908 次阅读 2018-1-27 21:35 |个人分类:R语言|系统分类:科研笔记

R的作图系统可以认为是基于两个系统。

1)传统的制图系统,允许逐步添加allow for incremental addition。

2)基于网格的制图系统(build upon grid),不允许逐步添加。主要的例子就是Trellis Graphic system,由lattice包提供。ggplot2也属于这一制图系统。


3.1 The traditional plot system

3.1.1 Plotting points, lines, polygons, and grids


很简单:plot(空间对象)即可

zig-zag 曲折的

(1)

image(SpatialPixels object) 会填满每个像素点

plot(SpatialPixels object)     会画出网格

两者效果是不一样的,可以试试看

(2)

在一幅地图里,如果没有声明CRS,那么x轴和y轴一单位是完全等同的,默认的屏幕长宽(aspect ratio)比也是根据图片的实际情况决定的。


3.1.2 Axes and layout elements

在plot函数中,加入axes = TRUE这一个函数选项,可以控制坐标轴的绘制

函数axis()则可以微调坐标轴的外观

不管我们加不加这个坐标轴,R语言里都会保留这部分的空间,这个时候根据内置的par()函数可以调节显示屏的性质。比如par(mar = c(0,0,0,0)+0.1)

一些有意义的引导图标,如比例尺(scale bar)和指北针(the north arrow)

但是我的R调取失败了,不知道为什么


3.1.3 Degrees in axes labels and reference grid

主要涉及地图的经纬度线,记录几个比较重要的函数

pruneMap()       returns a modified map object defined in the map packages

map2SpatialPolygons()   returns a SpatialPolygon object

map2SpatialLines()   returns a SpatialLines object

这三个具体的帮助说明:convert map objects to sp classes


spTransform() Method for function spTransform for map projection and datum transformation in package "rgdal"

先从投影转换说起:PROJ.4参数

另外几个标签:+datum tag


gridlines/gridat() Create N-S and E-W grid lines over a geographic region

grindlines returns an object of class SpatialLines, with lines as specified;

gridat returns a SpatialPointsDataFrame with points at the west and south ends of the grid lines created by gridlines, with degree labels.




https://blog.sciencenet.cn/blog-3376545-1097163.html

上一篇:R语言sp包学习笔记
下一篇:R语言的一些常用技巧
收藏 IP: 221.6.40.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-20 08:36

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部