尝试绘制一维图,在一条 X 轴上绘制一些点。目前,我有:
\begin{tikzpicture}
\begin{axis}[
xmin=0, xmax=22,
axis x line=bottom,% only show the bottom x axis
hide y axis,
scatter/classes={%
a={mark=o,draw=black}}
]
\addplot[scatter,only marks,
mark size = 3pt,
fill = red,
scatter src=explicit symbolic]
table {
3 0
6 0
9 0
12 0
15 0
18 0
};
\end{axis}
\end{tikzpicture}
不幸的是,圆圈没有出现在 x 轴上方(叠加)。我看到的是:
答案1
您需要添加最小值和最大值。
代码:
\documentclass{amsart}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xmin=0, xmax=22,
axis x line=bottom,% only show the bottom x axis
hide y axis,
ymin=0,ymax=5,
scatter/classes={%
a={mark=o,draw=black}}
]
\addplot[scatter,only marks,
mark size = 3pt,
fill = red,
scatter src=explicit symbolic]
table {
3 0
6 0
9 0
12 0
15 0
18 0
};
\end{axis}
\end{tikzpicture}
\end{document}
得出: