Skip to Main Content
数据科学之编程技术:使用R进行数据清理、分析与可视化
book

数据科学之编程技术:使用R进行数据清理、分析与可视化

by 迈克尔 弗里曼, 乔尔 罗斯
August 2021
Beginner to intermediate content levelBeginner to intermediate
450 pages
6h 13m
Chinese
Pearson
Content preview from 数据科学之编程技术:使用R进行数据清理、分析与可视化

16.5 ggplot2实战:绘制旧金山驱逐地图

为了展示ggplot2在可视化相关社会问题方面的能力,本节展示了旧金山在2017年归档的驱逐通知[1]。该分析的完整代码也可从本书代码库[2]在线获得。

在绘制地图数据之前,需要对原始数据集进行少量格式化(如图16-18所示)。

图16-18 从data.gov下载的驱逐通知数据的子集

可以使用ggmap包的开发版本中的qmplot函数,创建旧金山的背景地图。因为ggmap包是为使用ggplot2而创建的,所以可以使用geom_point()在地图上显示点。图16-19显示了2017年归档的每个驱逐通知的位置,使用下列代码创建:

图16-19 2017年旧金山归档的每个驱逐通知的位置。图像是使用ggplot2包在地图块上放置点层生成的 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

数据驱动力:企业数据分析实战

数据驱动力:企业数据分析实战

Carl Anderson
写给系统管理员的Python脚本编程指南

写给系统管理员的Python脚本编程指南

Posts & Telecom Press, Ganesh Sanjiv Naik
可编程网络自动化

可编程网络自动化

Jason Edelman, Scott S. Lowe, Matt Oswalt

Publisher Resources

ISBN: 9787111640899