如何区分图表中的多条线?

如何区分图表中的多条线?

我创建了一个包含多条(实际上是 10 条)不同颜色线条的图表(见示例)。我希望尽可能轻松地区分不同的线条。

例子

我想到了一些可能性:

  • 采取最多不同的颜色
  • 避免使用浅色(例如黄色 - 印刷品上的线条难以看清)
  • 使用图案(虚线、点线、不同的虚线图案) TikZ:获取预定义虚线图案的值
  • 使用不同的厚度(我不认为这是一个好主意)

这项任务是否有最佳实践、规则或指南?

我的示例代码:

\documentclass[border=5mm] {standalone}
\usepackage{pgfplots, pgfplotstable}
\begin{document}
\pgfplotstableread[col sep=&, header=true]{
description&A&B&C&D&E&F&G&H&I&K
2009&46&0&33&3&0&74&3&7&2&7
2010&35&0&22&1&0&90&2&5&3&3
2011&38&0&33&3&1&77&1&9&2&8
2012&25&0&15&0&4&55&4&5&0&1
2013&18&0&8&0&0&46&5&4&0&3
2014&37&0&54&1&3&54&5&12&10&2
2015&29&0&63&8&1&77&0&8&7&5
}\datatableentry
\begin{tikzpicture}
\begin{axis}[
  title={My Chart},
  enlarge y limits ={value=0.2,upper},
  xtick=data,
  xticklabels ={2009,2010,2011,2012,2013,2014,2015},  
  x tick label style={rotate=-45,anchor=west,font=\tiny},
  legend style={font=\tiny,legend pos=north west,legend cell align=left},
]
\addlegendentry{A};
\addplot [color=blue] table [y=A, x expr=\coordindex] {\datatableentry};
\addlegendentry{B};
\addplot [color=cyan] table [y=B, x expr=\coordindex] {\datatableentry};
\addlegendentry{C};
\addplot [color=gray] table [y=C, x expr=\coordindex] {\datatableentry};
\addlegendentry{D};
\addplot [color=yellow] table [y=D, x expr=\coordindex] {\datatableentry};
\addlegendentry{E};
\addplot [color=green] table [y=E, x expr=\coordindex] {\datatableentry};
\addlegendentry{F};
\addplot [color=lime] table [y=F, x expr=\coordindex] {\datatableentry};
\addlegendentry{G};
\addplot [color=black,loosely dashed] table [y=G, x expr=\coordindex] {\datatableentry};
\addlegendentry{H};
\addplot [color=red,densely dashed] table [y=H, x expr=\coordindex] {\datatableentry};
\addlegendentry{I};
\addplot [color=blue,dotted] table [y=I, x expr=\coordindex] {\datatableentry};
\addlegendentry{K};
\addplot [color=cyan,dashed] table [y=K, x expr=\coordindex] {\datatableentry};
\end{axis}
\end{tikzpicture}
\end{document}

免责声明:我不确定这个问题是否属于http://graphicdesign.stackexchange.com。主要问题是设计问题,但 Tikz 中需要解决方案。

答案1

从设计的角度来看,我无法说出最好的方法是什么。——但我可以展示我在类似情况下所做的事情。——使用颜色和标记。

\documentclass{standalone}
\usepackage{siunitx}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\begin{document}
\begin{tikzpicture}
  \begin{semilogxaxis}
    [
    width=\figwidth,
    height=0.75*\figwidth,
    scale only axis,
    font=\tiny,
    xmin=1, xmax=5000, xlabel={Energy [\si{\kilo\electronvolt}]},
    ymin=0, ymax=2.5, ylabel={Cross Section [\si{\angstrom\squared}]},
    log base 10 number format code/.code={ \pgfmathparse{10^(#1)}\num[round-mode=places, round-precision=0]{\pgfmathresult} },
    yticklabel={ \pgfmathparse{\tick*1}\num[round-mode=places,round-precision=1]{\pgfmathresult} },
    minor x tick num=9, minor y tick num=1,
    every tick/.append style={color=black},
    tick pos=left,
    legend style={draw=none, fill=none, inner ysep=0pt, outer sep=2pt, nodes={inner sep=1pt}, at={(1,1)}, anchor=north east},
    legend cell align=left,
    cycle multi list={{mark=+,mark=o}\nextlist{brown,magenta,teal,blue,lime,green,orange,cyan,gray}},
    mark size=0.8
    ]

    \addplot table...
    \addlegendentry{CTMC: Ermolaev(87)}    
    ...
    \node[anchor=west] at (axis cs: 1.2, 1.48) {F.--T. effective};
    \node[anchor=west] at (axis cs: 1.2, 0.44) {Fermi--Teller limit};

  \end{semilogxaxis}
\end{tikzpicture}
\end{document}

具有多个彩色图的样本

这张图片上的情节并不容易区分,但在印刷品中却容易得多。而且,只有在情节分歧的地方,区分才是重要的。

我只使用了实线和两种不同的标记,我认为这可以产生最好的效果。

相关内容