My question relates to this article by Davis and Chen (2006), in which it is shown a way to visualise Kendall's tau measure of non-parametric correlation between two variables.
Given a number of datapoints in a scatterplot, each point is connected to all the other points by a line segment. A line segment can be of different colours following these criteria:
- line segment is black if its slope is positive;
- line segment is red if its slope is negative;
- line segment is blue is its slope is 0 (horizontally flat line);
- line segment is black as in 1. if its slope is undefined (vertical line).
Here is an example from the original article:
My problem is that I can generate a scatterplot, but not the line segments that connect all possible pairs of points, changing colour depending on the criteria above.
Here is an example of dataset:
dataset <- dplyr::tibble(alpha = c(1, 5, 7, 8, 9, 10, 11, 12),
beta = c(7, 7, 5, 4, 3, 14, 15, 18))
I can generate this:
ggplot2::ggplot(dataset, aes(x = alpha, y = beta)) + geom_point()
but not this:
NOTE. The solution has to be generalisable to a dataset with a large number of datapoints (~1000)