I am new to coding and R. I was trying to visualize a correlation matrix using corrplot
, but don't want to show all the correlation values. I wish to hide/cancel a chunk of selected columns and rows correlation values, so only an inverted 'L' of values are shown.
As an example, see edited image of an example corrplot
here:
In some cases it is possible to consider two variable as one. If they are correlated, they are correlated. That is a simple fact. You can't "remove" a correlation.
[ R , PValue ] = corrplot( Tbl ) plots the Pearson's correlation coefficients between all pairs of variables in the table or timetable Tbl , and also returns tables for the correlation matrix R and matrix of p-values PValue .
The easiest way to visualize a correlation matrix in R is to use the package corrplot. In our previous article we also provided a quick-start guide for visualizing a correlation matrix using ggplot2. Another solution is to use the function ggcorr() in ggally package.
R package corrplot provides a visual exploratory tool on correlation matrix that supports automatic variable reordering to help detect hidden patterns among variables. corrplot is very easy to use and provides a rich array of plotting options in visualization method, graphic layout, color, legend, text labels, etc.
Set those entries you want blank in the plot to NA
in the correlation matrix (or a copy of it) and then set the argument na.label=" "
in the call to corrplot.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With