如何區分圖表中的多條線?

如何區分圖表中的多條線?

我創建了一個圖表,其中包含許多(實際上 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}

具有多個彩色圖的範例

要區分這張圖片上的圖並不容易,但要印出來就容易多了。 -而且,只有情節發生分歧時,區分才重要。

我只使用了實線和兩個不同的標記,我認為這是最好的結果。

相關內容