When reading this question, I started to think whether it would be possible to convert colors to imitate an average greyscale printer (assuming that your screen is calibrated)?
Use an HCL palette with chroma set to zero to create greyscale values that are indistinguishable to the human eye.
library(colorspace)
n <- 10
cols <- rainbow_hcl(n)
plot(seq_len(n), cex = 5, pch = 20, col = cols)
greys <- rainbow_hcl(n, c = 0)
plot(seq_len(n), cex = 5, pch = 20, col = greys)
If you want to generate the greys from your original colours, use the scales
package.
library(scales)
greys2 <- col2hcl(cols, c = 0)
plot(seq_len(n), cex = 5, pch = 20, col = greys2)
The col2grey
(and/or col2gray
) function in the TeachingDemos package uses one common method for doing this. The idea is to see what your colors will look like when printed or copied in grayscale instead of color.
The desaturate()
function in the `colorspace package can also be used to convert colors to their gray levels only. This collapses chroma (colorfulness) in the HCL (or polar CIELUV) representation of the colors.
plot(1:4, type = "p",
col = colorspace::desaturate(c(Rl, Rd, Cl, Cd)),
pch = 19, cex = 8, xlim = c(0,5), ylim = c(0,5))
You can use one of the 3 conversion algorithms outlined here, and just determine if they're outside whatever tolerance you think is too similar.