When using dotted
line style in a pgfplot
, I realised that the dots are really square dots.
Usually most people associate dot with a filled circle(or is it just me?). And I know that there are workarounds to get the 'real dotted' line style.
I am curious to know why pgfplot
associates dot with a square dot, by default, in line style.
Here is source for the above figure:
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xlabel= $x$,
ylabel= $y$,
ymax = 6,
legend columns=-1,
]
\addplot[mark=none, black, dotted] coordinates {(0,2) (5,2)};
\addplot[mark=none, black,thick, dotted] coordinates {(0,3) (5,3)};
\addplot[mark=none, black, very thick,dotted] coordinates {(0,4) (5,4)};
\addplot[mark=none, black, ultra thick,dotted] coordinates {(0,5) (5,5)};
\node at (axis cs:2.5, 1.8){default};
\node at (axis cs:2.5, 2.8){thick};
\node at (axis cs:2.5, 3.8){very thick};
\node at (axis cs:2.5, 4.8){ultra thick};
\end{axis}
\end{tikzpicture}
\end{document}
Best Answer
This is not a TeX or any TeX package issue but how PDF specifications are defined.
pgfplots
relies on TikZ and TikZ relies on PS/PDF instructions that are finally used inside the end result.Dotted and dash-dotted lines are short lines drawn on and off very much like a TikZ decoration. For example if you add
line cap=round
you see the difference.