Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

A plot I originally prepared using colors needs to be printed in a journal that only permits black and white graphics. My question is two-fold:

  1. What is the best way to clearly make different graphs distinguishable?
  2. How can I to this with PGF plots?

I searched through the manual of PGF plots but there seems to be no dedicated option "colors=bwonly" or something similar (maybe a convenient addition for future versions?).

For reference, here is my original graph:

\documentclass{minimal}

\usepackage{pgf,tikz}
\pgfplotsset{compat=1.5.1}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
    %small,
    ybar,%=8pt, % configures ‘bar shift’
    enlargelimits=0.15,
    ylabel={index},
    symbolic x coords={1982, 1990, 1999, 2006},
    %xtick=data,
    %tick label style={font=\footnotesize},
    legend style={at={(0.5,-0.15)},
    anchor=north,legend columns=-1},
    nodes near coords,
    %every node near coord/.style={font=\footnotesize},
    nodes near coords align={vertical},
    ]
\addplot coordinates {(1982, 1.78) (1990, 1.71) (1999, 1.68) (2006, 1.62)};
\addplot coordinates {(1982,  1.70) (1990, 1.62) (1999, 1.59) (2006, 1.64)};
\addplot coordinates {(1982, 2.04) (1990, 1.96) (1999, 1.95) (2006, 1.91)};
\legend{A, B, C}

\end{axis}
\end{tikzpicture}

\end{document}
share|improve this question
    
IMHO the best way to make distinguishable several graphs is to use different line styles and markers beside using different shades of gray. –  Count Zero May 20 '12 at 11:43

1 Answer 1

up vote 6 down vote accepted

You can define your own color list and line style list as explained in Section 4.6.7 in the pgfplots manual.

\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
    ybar,
    enlargelimits=0.15,
    ylabel={index},
    symbolic x coords={1982, 1990, 1999, 2006},
    legend style={at={(0.5,-0.15)},
    anchor=north,legend columns=-1},
    nodes near coords,
    nodes near coords align={vertical},
    cycle list = {black,black!70,black!40,black!10}
    ]
\addplot+[] coordinates {(1982, 1.78) (1990, 1.71) (1999, 1.68) (2006, 1.62)};
\addplot+[fill,text=black] coordinates {(1982,  1.70) (1990, 1.62) (1999, 1.59) (2006, 1.64)};
\addplot+[fill,,text=black] coordinates {(1982, 2.04) (1990, 1.96) (1999, 1.95) (2006, 1.91)};
\legend{A, B, C}
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer
    
Are solid colors preferable over, for instance, different kinds of hatching? If yes, can you explain why? –  Ingo May 20 '12 at 11:58
    
@Ingo There can be no such fixed rules. Every plot needs to be examined and should be adjusted accordingly to emphasize the data over style. What I have given is just an example but needs more tweaks. –  percusse May 20 '12 at 12:02
1  
@Ingo: I personally find hatched bar graphs distracting and more difficult to read than solid bars. I've seen some that were really horrible to look at. But that's just my opinion, you should decide it for yourself. –  Count Zero May 20 '12 at 14:33
1  
That is grey scale. Black and white would be patterns. –  user47580 Mar 8 at 16:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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