19

I'd like to draw a plot with a very thin line but large markers, like in the following example

\documentclass[tikz]{standalone}
\RequirePackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}
  \addplot [thin, mark = none] coordinates {(0,0) (1,1)};
  \addplot [only marks,thick] coordinates {(0,0) (1,1)};
\end{axis}
\end{tikzpicture}

\end{document}

So far I can't define a single style to that effect since the same option (thick or thin) is used for both the marker and the line.

EDIT: The problem arises when one uses markers like + or x:

\documentclass[tikz]{standalone}
\RequirePackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}
  \addplot [thin, mark = none,blue] coordinates {(0,0) (1,1)};
  \addplot [only marks, thick,mark = +,blue] coordinates {(0,0) (1,1)};

  \addplot [thin, mark = +, mark size=8pt,red] coordinates {(0,1) (1,0)};
\end{axis}
\end{tikzpicture}

\end{document}

I'd like to get the blue plot in the following picture

enter image description here

  • Like this ? \addplot+[thin,draw=black,mark options={black}] coordinates {(0,0) (1,1)}; – percusse Sep 7 '15 at 13:26
20

You can use mark options and a scale factor, or mark size to control the marks:

\documentclass[tikz]{standalone}
\RequirePackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot+[ultra thin,mark options={scale=4}] coordinates {(0,0) (1,1)};
\addplot+[line width=3pt,mark size=6pt] coordinates {(0,0.5) (1,0.5)};
\end{axis}
\end{tikzpicture}

\end{document}

enter image description here

The every mark style can be used to set the mark options "globally":

\documentclass[tikz]{standalone}
\RequirePackage{pgfplots}
\begin{document}
\begin{tikzpicture}[every mark/.append style={mark size=8pt}]
\begin{axis}
\addplot+[ultra thin] coordinates {(0,0) (1,1)};
\addplot+[line width=3pt] coordinates {(0,0.5) (1,0.5)};
\end{axis}
\end{tikzpicture}

\end{document}

I chose a rather large mark size just for the example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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