1
$\begingroup$

I have 48 curves that I need to put in a single plot. Below is the current version of the plot; I made it using ggplot2.

My plot

The curves belong to four groups; each group has 12 curves. I'd like to color the curves in the same group using 12 shades of the same color, and I'd like to use different colors for different groups, e.g., 12 shades of red for group 1, 12 shades of blue for group 2, etc. However, I need to choose colors and shades that are colorblind-friendly. Is it possible to meet these requirements? If so, are there any R packages I can use to do this?

$\endgroup$
4
  • $\begingroup$ Can you supply a reproducible sample by using dput() of a portion of your data set or a simulated data set? $\endgroup$ Apr 24, 2020 at 5:30
  • $\begingroup$ Relevant threads include stats.stackexchange.com/questions/190152/… $\endgroup$
    – Nick Cox
    Apr 24, 2020 at 7:57
  • $\begingroup$ Recent article on color mapping. $\endgroup$
    – BruceET
    Apr 24, 2020 at 8:28
  • $\begingroup$ The role of a figure is to illustrate the effects of independent factors on dependent variable. Adding 48 curves to a plot doesnot help. Instead, you can use facetting to show the variation for each groups. $\endgroup$ Jun 24, 2020 at 11:56

2 Answers 2

3
$\begingroup$

BruceET's answer addresses a number of critical technical challenges that such an extensive colour scheme would encounter. I would add that if you want to overlay 4 different hues each with intensity graduations then it will quickly become indecipherable what is going on. You need to think more cleverly about how to combine the information in a sequence of plots that will highlight the critical information the viewer will need to be able to see.

I'm working on a paper with a sequence of figures that uses hue for sample coding, shading for variable coding (the variables form a sequence) so in some plots we have intense hues (primary and secondary RGB colours) per sample, in others shaded greyscale for variables and in some cases we have sample and variable interactions that use shaded versions of the hues. However, in all plots the sample and variable lines are offset to avoid overlap and I use subplots in each figure to spread the different comparisons out.

How about a sequence of plots within each group used to identify a smaller, more manageable number of interesting lines? Then a final plot overlaying the most relevant lines? If there are multiple possible ways of deciding what is an interesting trend, then pick out the ones that share common traits in each group to overlay in separate plots for each aspect.

Once you have worked out a workflow to sieve down the information in a traceable way then there are lots of resources to test what your output looks like to a colorblind person for the main forms of colorblindness.

Online drag and drop simulator here.

Medium post on some free tools

A icon tray tool that I've used extensively. It works across multiple monitors, you access it by right clicking on its icon and choosing the form of colorblindness you want to simulate. It then reverts to normal as soon as you click again.

$\endgroup$
2
$\begingroup$

Colors are well chosen in the plot you show. But for just 12 curves, you have pretty much exhausted hues that most people with good color vision will be able to distinguish. I fear you will have an indecipherable mess with 48.

The basic graphics part of R supports both the RGB and HSV systems of specifying colors.

  • RGB coordinates with the additive color system used in monitors, roughly specifying the brightness of red, green, and blue pixels. (When red, green, and blue pixels are fully illuminated, the result is white.) Many people find it difficult to visualize in advance what a particular RGB code will produce on screen. A complicating counterintuitive feature is that full R with full G produces yellow.

  • HSV stands for hue saturation and value. Many people find this method more intuitive. Hue is frequency of the rainbow. Saturation is runs from grey to full intensity of the hue. (A dusty rose might be halfway up the saturation scale for red, wedgewood blue might be moderately saturated blue.) Value (brightness) runs from nearly black to nearly white. (For blue, that scale might run from midnight blue to pale sky blue.)

Not supported in R, as far as I know is the YMC (for yellow, magenta, cyan) subtractive system used in color printing. By using pigments that subtract yellow, magenta, and cyan wavelengths from white paper background, one would theoretically get black. However, due to imperfections in standard colored ink, the result can be more like a muddy brown, so black ink is added as a 4th color to ensure sharper black and more faithful reproduction of darker colors.

Accommodating to color blindness is challenging because there are several kinds and degrees. The most common form of color blindness is inability to distinguish red (typically from green). So if you're using complementary colors in a 2-color scheme, it's better to use orange and cyan instead of red and blue. I see no way to display even 12 colors in a way that would be helpful to most, say 75%, of color-vision deficient people (mostly men).

I once tried making bivariate color maps using a grid of 16 colors, including black, dark grey, light grey, and white on the principal diagonal (along with tones of orange and cyan) referenced here. It is an expensive challenge to get consistent color reproduction for such a color scheme.

  • High quality monitors must be fastidiously tuned to keep greys from edging towards red or blue or green.
  • The quality of color printing in popular magazines is far inferior to the color printing in costly books that can do justice to reproductions of famous paintings.

So if you arrive at your favorite color scheme for your favorite graphic image, you may be sadly disappointed to see results on a different monitor or from a color printer.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.