Correlation plot

25 views
Skip to first unread message

Eduardo Beche

unread,
Sep 7, 2018, 3:42:15 AM9/7/18
to ggplot2

Hi

I am interested in plot correlations from two different set of data below and above the diagonal line. Does somebody have any idea how I can code that?

Thanks

Ron Crump

unread,
Sep 7, 2018, 4:51:02 AM9/7/18
to Eduardo Beche, ggplot2
Hi Eduardo,

> I am interested in plot correlations from two different set of data
> below and above the diagonal line. Does somebody have any idea how I can
> code that?

Do I have this right: you have two datasets (a and b) containing the
same variables and you want to do a symmetric grid/matrix of plots such
that variables i and j are in row i and col j for dataset a and row j
col i for dataset b?

What do you plan to put in the diagonal plots?

Do you just want to put the correlation in the plot? In that case why
not use a table? Or do you really want a scatterplot (or hexbin or some
other way of representing the joint distribution of the data), maybe
with the correlation value overlaid? Or a 'heatmap'? Or ellipses?

You need to define what you have and what you want to get out a bit more
clearly.

What have you tried? Do you have some (example) data and your code
that you could put in a reprex (reproducible example) that would be
helpful to let people play around with your problem.

You might be able to make a start with ggpairs or ggcorr from the GGally
package, or the ggcorrplot package. But your dual datasets may make it
more awkward.

Regards,
Ron.
Reply all
Reply to author
Forward
0 new messages