13

I would like to specify different default line widths for plots and for markers (like x-marker). For the plot line width, I use:

\pgfplotsset{every axis plot/.append style={line width=1pt}}

Yet, this sets both the line widths of plots and markers. So, either I need an option which only applies to plot lines, or I need to change back the marker line width. Additional marker options are specified locally. Is there something like every marker/.append options?

Best Regards!

1
  • Welcome to TeX.SX! Did you try the every mark/.append style key detailed on Pg. 163 of the pgfplots v1.12 manual? If so, and it didn't work, can you please post a MWE and let us know what went wrong? Thanks!
    – darthbith
    Mar 27, 2015 at 17:36

1 Answer 1

11

You can use the every mark style; however, due to the way this style is processed, you need to add it to every axis plot post to make sure all the keys are evaluated appropriately:

\documentclass{article} 
\usepackage{pgfplots}

\pgfplotsset{
  every axis plot/.append style={line width=0.8pt},
  every axis plot post/.append style={
    every mark/.append style={line width=1.6pt,draw=green,fill=red}
  }
}

\begin{document} 

\begin{tikzpicture}
\begin{axis}
\addplot coordinates {(-2,0) (-1,1) (0,0) (1,1) (2,0)};
\end{axis}
\end{tikzpicture}

\end{document}

The result:

enter image description here

Simply saying

\pgfplotsset{
  every axis plot/.append style={line width=0.8pt},
    every mark/.append style={line width=1.6pt,draw=green,fill=red}
}

in the above example won't have the desired effect.

An example using mark=x:

\documentclass{article} 
\usepackage{pgfplots}

\pgfplotsset{
  every axis plot/.append style={line width=0.8pt},
  every axis plot post/.append style={
    mark=x,
    every mark/.append style={line width=1.6pt,draw=red,scale=2}
  }
}

\begin{document} 

\begin{tikzpicture}
\begin{axis}
\addplot coordinates {(-2,0) (-1,1) (0,0) (1,1) (2,0)};
\end{axis}
\end{tikzpicture}

\end{document}

enter image description here

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.