7

I am using pgfplots to create comb figures such as the following.

\documentclass{article}
\usepackage{pgfplots}
\usepackage{xcolor}

\begin{document}

\begin{figure}
\centering
\begin{tikzpicture}
\begin{axis}
\addplot+[ycomb,color=black] plot coordinates
{(0,3) (1,2) (2,4) (3,1) (4,2)};
\end{axis}
\end{tikzpicture}
\end{figure}

\end{document}

I want to change the default color from blue to black. However, the above code only changes the outer boundary of the circles on the top of the combs, while the filled color is still blue. Is there anyone know how to change the inner color ?

13

The comb ends are markers that you can format via mark options

\documentclass{article}
\usepackage{pgfplots}

\begin{document}

\begin{figure}
\centering
\begin{tikzpicture}
\begin{axis}
\addplot+[ycomb,mark options={black}] plot coordinates
{(0,3) (1,2) (2,4) (3,1) (4,2)};
\end{axis}
\end{tikzpicture}
\end{figure}

\end{document}

enter image description here

0

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.