In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the knowledge of "R language Visualization REmap package usage". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Starting today, we will follow you to learn a new visual R package-the REmap package.
Speaking of, this package is due to Baidu's visualization open source project-echarts, which is one of the few high-level open source visualization js libraries in China and has a second to none position in the industry.
Through the efforts of the Great God, we can finally call the core functions of Echarts in the form of concise REmap functions in R language, and we can create dynamic map visualization works without having to learn js code.
If you have friends who are familiar with Baidu's big data visualization project-Baidu migration map, as well as the traffic commuter map, as well as the later Belt and Road Initiative visualization road map, they must be very impressed by the lines and paths that flow on the dynamic map.
Let's start with a brief introduction to the main functions of REmap:
The REmap package contains a set of functions that I know and have used are REmap, REmapB, REmapC, and REmapH.
Each function corresponds to several cool types of dynamic effects:
Today we first introduce the REmap function and use it to make a simple flow chart:
Install and load:
Install.packages ("devtools")
Devtools::install_github ("lchiffon/REmap") # developer / package name
Library (REmap) # load
In fact, the mapping concept of REmap function is similar to that of ggplot. It also expresses data information and aesthetic information separately. Data information is included in the data table, while landscaping parameters are included in theme.
Remap (mapdata, title = ""
Subtitle = ""
Theme = get_theme ("Dark"))
This is a typical REmap function structure, mapdata is the data frame format dataset we want to show, which contains two columns of data: start location, end information.
Title is used to set the main title and subtitle is used to set the subtitle. While theme is used to set the theme style of the whole graph, the theme is an encapsulated function variable, which contains a lot of parameter information (various point, line and surface color, measurement, etc.).
The following is an example of parameters within a typical REmap topic:
Get_theme (theme = "Dark"
LineColor = "Random"
BackgroundColor = "# 1b1b1b"
TitleColor = "fff"
BorderColor = "rgba (100pr 149pr 237je 1)"
RegionColor = "# 1b1b1b"
LabelShow = T
PointShow = F
PointColor = "gold")
Parameter description:
Parameter 1: theme is the overall color matching. The default options are "Dark", "Bright", "Sky" and "none".
Parameter 2: lineColor is the line color, default is random, or you can set it by yourself, such as' red'
Parameter 3: backgroundColor is the background color outside the map.
Parameter 4: titleColor is the title color
Parameter 5: borderColor is the edge color of the region in the map, the edge of different provinces and cities
Parameter 6: regionColor is the regional color, that is, the color displayed on the map
Parameter 7: labelShow is a logical parameter. Whether to display the region name. Default is T, that is, display. It is only used for remapC function.
Parameter 8: pointShow is a logical parameter, whether to display the point where the region is located. The default is F, and it is not displayed. It is only used for remapC function.
Parameter 9: pointColor is the color of the point in pointShow and is only used for the remapC function.
REmap can easily obtain longitude and latitude data of city locations:
Take Dalian as an example:
Get_city_coord ("Dalian")
[1] 121.62139 38.91934
If you want to get a set of longitude and latitude information for a city, you can assign it directly to the city vector:
City_list
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.