1

For example, can I adjust the line thickness, color, or transparency, without also changing the markers?

MWE:

\documentclass[margin=5pt]{standalone}

\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.3}

\begin{document}

    \begin{tikzpicture} 

        \begin{axis}
        
        \addplot+[ycomb] coordinates {(0,3) (1,2) (2,4) (3,1) (4,2)};

        \end{axis}

    \end{tikzpicture}

\end{document}

enter image description here

2
2

First set the line options and then (re)set the mark options:

\documentclass[margin=5pt]{standalone}

\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.3}

\begin{document}

    \begin{tikzpicture} 

        \begin{axis}
        
        \addplot+[ycomb,red,dash dot, line width=1pt,opacity=0.5, mark options={blue, solid, opacity=1}] coordinates {(0,3) (1,2) (2,4) (3,1) (4,2)};

        \end{axis}

    \end{tikzpicture}

\end{document}

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.