In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to use corrplot in R language to draw the heat map of correlation coefficient matrix". The content of the explanation in this article is simple and clear, and it is easy to learn and understand. please follow the editor's train of thought to study and learn "how to use corrplot in R language to draw correlation coefficient matrix heat map".
R language is also one of the commonly used data analysis programming languages, and its function is also powerful after the development of users and scientists. This paper introduces the use of corrplot in R language to draw the heat map of correlation coefficient matrix.
Take the house price data of Boston in Boston as an example, which is commonly used in data mining and machine learning, and can be downloaded from UCI's machine learning database: archive.ics.uci.edu/ml/
The dataset has 506 observation samples and 14 variables:
First, import the data into the R software:
> mydata summary (mydata)
Then calculate the correlation coefficient and download the correlation coefficient matrix corrplot package:
> res install.packages ("corrplot") # download the correlation coefficient matrix corrplot package
> corrplot (res, method = "shade", shade.col = NA, tl.col = "black", tl.srt = 45, order = "AOE") # draw the matrix diagram of correlation coefficient
Get the graphics:
The darker the color in the correlation coefficient diagram, the closer the correlation coefficient between the two variables is. As can be seen in the chart, the median house price (MEDV) column of Boston has the greatest correlation with variables such as LSTAT, PTRATIO, RM, etc.
Let's focus on the function corrplot:
In the command corrplot (res, method = "shade", shade.col = NA, tl.col = "black", tl.srt = 45, order = "AOE")
Res: represents the correlation coefficient matrix that needs to be visualized
Method = "shade" represents the specified visualization method, which can be circular, square, oval, numeric, shadow, color, or pie figure, method = c ("circle", "square", "ellipse", "number", "shade", "color", "pie")
Shade.col = NA: specifies the color of the graphic display, which is displayed in a uniform color by default
Tl.col: specifies the color of the text label, that is, the color of the text label of the graphic. The default is black.
Tl.srt = 45, indicating the size of the text label
Order = "AOE": specify the sorting method of correlation coefficient, which can be original order (original), feature vector angular order (AOE), first principal component order (FPC), hierarchical clustering order (hclust) and alphabetical order. Generally, the sorting result of "AOE" is better than that of "FPC". Order = c ("original", "AOE", "FPC", "hclust", "alphabet").
According to the different attributes of the corrplot function, you can transform the attributes and draw different correlation coefficient matrix heat maps:
Thank you for your reading, the above is the content of "how to use corrplot in R language to draw the heat map of correlation coefficient matrix". After the study of this article, I believe you have a deeper understanding of how to use corrplot in R language to draw the heat map of correlation coefficient matrix. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.