I have a figure in my paper which compared 6 different cases. The figure needs to be in black and white.
In below is the code I used to create the figure.
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[%
width=10cm,
height=4cm,
scale only axis,
xmin=1, xmax=3,
xtick={1,2,3},
xticklabels={Step1,Step2,Step3},
xmajorgrids,
ymin=0.4, ymax=1.2,
ylabel={$\xi$},
ymajorgrids,
title={Stroke Ratio Comparison},
axis lines*=left,
line width=1.0pt,
mark size=2.0pt,
legend style={at={(1.03,1)},anchor=north west,draw=black,fill=white,align=left}]
\addplot [
color=black,
solid,
mark=*,
mark options={solid},
smooth
]
coordinates{
(1,0.941517254116162)(2,0.833049791172753)(3,0.911012408209885)
};
\addlegendentry{$L/D$=2.5};
\addplot [
color=black,
dotted,
mark=*,
mark options={solid},
smooth
]
coordinates{
(1,0.848646925806495)(2,0.889383162622147)(3,0.901265846062356)
};
\addlegendentry{$L/D$=3.5};
\addplot [
color=black,
dash pattern=on 1pt off 3pt on 3pt off 3pt,
mark=*,
mark options={solid},
smooth
]
coordinates{
(1,0.773775422607358)(2,0.836291579743709)(3,0.91821563038864)
};
\addlegendentry{$L/D$=4.0};
\addplot [
color=black,
dashed,
mark=*,
mark options={solid},
smooth
]
coordinates{
(1,0.846412925696005)(2,0.909313371999676)(3,0.916886900310392)
};
\addlegendentry{$L/D$=4.5};
\addplot [
color=black,
dash pattern=on 3pt off 6pt on 6pt off 6pt,
mark=*,
mark options={solid},
smooth
]
coordinates{
(1,0.884302757051131)(2,0.941642806394511)(3,0.995341242858434)
};
\addlegendentry{$L/D$=5.0};
\addplot [
color=black,
dotted,
mark=*,
mark options={solid},
smooth
]
coordinates{
(1,0.789821315674376)(2,0.981738703732297)(3,1.04121306622012)
};
\addlegendentry{$L/D$=6.0};
\end{axis}
\end{tikzpicture}%
\end{document}
Here is the result of the compilation.
I would like to have different marker shape such that the figure is easy to understand. Also, as can be seen, the legend does not clearly illustrate the differences between line types. How can I make this more clear to the reader? I would be grateful if I could use other's experiences on creating a professional figure?
Best Answer
I think you need to understand differences between
\addplot
,\addplot[]
and\addplot+[]
commands. According topgfplots
manual:You use
\addplot[...]
, so you are setting the style for every plot, avoiding predefined styles. You can do this, no problem, but don't use same style (line, color and marker) for every plot. If you look at manual, you'll find how to change markers (square, triangle, star, ...).But I'd prefer
\addplot
or\addplot+[]
because this way, all predefined styles are used and you don't have to worry about selecting them. The is a predefined cycle list for black and white plots. You can select it withcycle list name=black white
.In next code I've also made some other changes (mainly x and y margins) which can easily forget.
black white
cycle list changesmarks
but only usessolid
anddashed
lines. If you prefer to use a different line and mark, it's possible to define your owncycle list
which it's only a list withline
andmark styles
. Using nextcycle list
you will get: