In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article shows you how to use R language and Python spatial data visualization and data map, concise and easy to understand, absolutely can make you shine, through the detailed introduction of this article I hope you can gain something.
In the past, I always felt that Python's drawing tools were not elegant enough compared with R language ggplot2. This is also the reason why I have always firmly chosen to use R+ggplot2 to deeply study data visualization. ggplot2 is really superior in the integration, compatibility and scalability of coordinate system. Therefore, ggplot2 has become a giant of visualization and WeChat in the visualization world. Not only is its ecology becoming more and more perfect, There are also numerous developers who develop accessibility packages for it (you can understand them as Mini programs attached to WeChat).
Recently, in the process of learning Python visualization by chance, I learned about geopandas, which really looks familiar at first glance. Maybe you can associate it with pandas at first sight. Indeed, it is inextricably linked to pandas and inherits many of the high-frequency functions of pandas. And what the hell is geo?
Geo stands for Geographic Information System, and geopandas is Python's up-and-comer for spatial geospatial data (why up-and-comer, because there's a package called basemap that's supposedly hard to use, and I haven't gotten into it yet).
Today's topics are the sf package in R and the geopandas library in Python.
The reason why geopandas and R spatial data visualization are written together today is because they coincidentally use the same geographic information processing technology, both in terms of data source support, spatial data structure storage, and projection settings.
I've written a lot about ggplot2 spatial data visualizations before, but most of them are based on shp data sources and the geom_ploygon or gemo_map functions in ggplot2.
Right, you're not mistaken, there really is such an operation ~
The maptools package on which shp data source import depends is about to be abandoned, and the data structure supported by geom_ploygon and gemo_map functions is complex and difficult to understand. It is a challenge for beginners and veterans alike. It requires a lot of data merging, conversion and matching, and the time and code amount spent on data processing in the early stage have far exceeded the amount of visual code.
Fortunately, new technologies are always emerging. The json format data on the data source provides us with more convenient, efficient and inexpensive spatial data information, while the sf package can use the intuitive Simple Features data structure to reorganize the map data source, so that in the past, it was necessary to prepare geographical boundary attribute information and geographical boundary latitude and longitude information to present geospatial information data structure.
Coincidentally, geopandas in Python uses the same technique to simplify the complexity of spatial data visualization, and its core idea is to compress a single geographic polygon into a Simple Features, so that all geographic polygons are strictly aligned with their attribute information, and a friendly data frame with geographic information.
Perhaps the above description is too abstract, because the content involved is more in-depth, I really do not know how to put these contents will be easy to understand, the next will use pictures to assist demonstration.
The traditional way to make maps in R is to use geom_ploygon+maptools+shp data
library(ggplot2)
library(plyr)
library(maptools)
#Data import:
china_map
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.