This article introduces the Corrplot () function in the Corrplot package to visualize the correlation coefficients, first to look at the syntax of the function and some important parameters:
Corrplot (Corr, method = C ("Circle", "Square", "Ellipse", "number", "shade", "color", "pie"), type = C ("full", "lower", "up Per "), add = False, col = NULL, bg =" White ", title =" ", Is.corr = True, Diag = true, outline = false, Mar = C (0,0,0,0), Addgrid.col = null, Addcoef.col = null, addcoefaspercent = FALSE, order = C ("original", "AOE", "FPC", "Hclust", "Alphabet" ), Hclust.method = C ("Complete", "Ward", "single", "average", "mcquitty", "median", "centroid"), Addrect = NULL, Rect.col = "Black", RECT.LWD = 2, Tl.pos = null, Tl.cex = 1, Tl.col = "Red", Tl.offset = 0.4, tl.srt = all, Cl.pos = null, Cl.lim = NULL, cl.length = NULL, Cl.cex = 0.8, Cl.ratio = 0.15, Cl.align.text = "C", Cl.offset = 0.5, Addshade = C ("negative", "posi tive "," All "), SHADE.LWD = 1, Shade.col =" White ", P.mat = NULL, Sig.level = 0.05, Insig = C (" pch "," P-value "," Blank "," n ") , PCH = 4, Pch.col = "Black", Pch.cex = 3, Plotci = C ("n", "Square", "Circle", "rect"), Lowci.mat = null, Uppci.mat = NULL, ...)
Corr: a Correlation coefficient matrix method that needs to be visualized: Specifies a visual approach, which can be a circle, square, ellipse, value, shadow, color, or pie shape
Type: Specifies the way in which the presentation can be complete, lower triangle, or upper triangle
Col: Specifies the color of the graphic display, which is displayed by default in a uniform color
BG: Specifies the background color of the graph title: Add a title to the graphic
Is.corr: is the correlation coefficient plotted, the default is true, and the visualization of non-correlation coefficients can also be achieved by setting the parameter to False
Diag: whether to show results on diagonal, default to True
outline: whether to draw a rounded, square, or oval outline, false by default
Mar: Specify the four-sided spacing of the graph
addgrid.col: The default gridline color is white when the selected method is color or shadow, otherwise gray
Addcoef.col: adds a color to the correlation factor, does not add a correlation factor by default, only works if the method is number
addcoefaspercent: to save drawing space, convert correlation coefficients to percent format, default to False
Order: Specifies the method of ordering the correlation coefficients, which can be the original order (original), the feature vector Corner Order (AOE), the first main component order (FPC), The Hierarchical Clustering Order (Hclust), and the alphabetical order, and the general "AOE" sort result is more than "FPC" Better
Hclust.method: When order is hclust, this parameter can be one of 7 kinds of Ward method and maximum distance method in hierarchical clustering.
Addrect: When order is hclust, you can add a rectangle box to the add correlation coefficient graph, without adding a box by default, and if you want to add a box, simply specify an integer for the parameter
Rect.col: Specifies the color of the rectangle box
RECT.LWD: Specifies the line width of the rectangle box
Tl.pos: Specifies the position of the text label (variable name) when Type=full, the default label position on the left and top (LT), when Type=lower, the default label on the left and diagonal (LD) when Type=upper, Default label at top and diagonal, d for diagonal, N for no text label
Tl.cex: Specify the size of the text label
Tl.col: Specifies the color of the text label
Cl.pos: legend (color) position, when Type=upper or full, legend in the right table (r), when Type=lower, legend at the bottom, when no legend is required, just specify that the parameter is n
Addshade: This parameter is useful only when Method=shade, the parameter value can be negtive/positive and all, and the table representation adds shading to negative correlation coefficients, positive correlation coefficients, and all correlation coefficients. Note: The shadow of the positive correlation coefficient is 45 degrees, and the shadow of the negative correlation coefficient is 135 degrees.
SHADE.LWD: Specifies the line width of the shadow
Shade.col: Specifies the color of the hatch line
R language Corrplot