31

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

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

1 Answer 1

36

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .