[Tex/LaTex] Greyscale compatible colours for TikZ

colorprinting

I am looking for five different colours/fill styles for the bars in a TikZ chart. The bars are quite narrow. I want them to be distinctive when viewed onscreen or printed in colour, but also distinctive if the same PDF file gets printed in black and white.

Can anyone recommend a good set of colour definitions? Or some other way of filling the bars to make them distinctive in both scenarios? A bonus (non-essential) would be if colour-blind people could also tell them apart easily.

To clarify, I do not want to produce a greyscale PDF file, or generate a separate output for black and white printing, as I have seen in some other answers. Thanks!

Best Answer

I would suggest using a basic color that you can then mix with different amounts of white and black to create five different shades of this color. In the following example, I have used blue as the base color, but the same can also be done using other colors (such as red and green, as shown in the image below).

\documentclass[a4paper, 12pt]{article}
\usepackage{pgfplots}
\begin{document}

  \begin{tikzpicture}
    \begin{axis}[
        xmin=0,
        xmax=6,
        xtick={1,2,3,4,5},
        ytick={0,5},
        ymin=0,
        ymax=5,
        every axis plot/.append style={
          ybar,
          bar width=10pt,
          bar shift=0pt,
          fill
        }
      ]
      \addplot[blue!15!white]coordinates {(1,5)};
      \addplot[blue!40!white]coordinates{(2,5)};
      \addplot[blue]coordinates{(3,5)};
      \addplot[blue!60!black]coordinates{(4,5)};
      \addplot[blue!15!black]coordinates{(5,5)};
    \end{axis}
  \end{tikzpicture}
\end{document}

The same bar charts converted to grayscale are shown next to the coresponding colored chart in the following image:

enter image description here