
我用來pgfplots
創建如下所示的梳子圖形。
\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}
我想將預設顏色從藍色更改為黑色。然而,上面的程式碼只改變了梳子頂部圓圈的外邊界,而填滿顏色仍然是藍色。有人知道如何改變內部顏色嗎?
答案1
梳子末端是標記,您可以透過以下方式格式化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}