我正在尝试在特定坐标的轴上绘制一组连接节点。我尝试过:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[->,thick] (0,0)--(8,0) node[right]{$t$};
\draw[->,thick] (0,-2)--(0,4) node[above]{$y$};
\foreach[count=\i] \coord in {(0,0),(0.5,0),(1,3.9),(1.5,2),(2,0),(2.5,0),
(3,0),(3.5,0),(4,0),(4.5,0),(5,0),(5.5,0),
(6,0),(6.5,0),(7,0),(7.5,0)}
{
\node (n\i) at \coord {\tiny\textbullet};
}
\foreach \i in {2,...,16}
{
\pgfmathsetmacro{\result}{\i - 1}
\draw (n\result.center) -- ({n\i}.center); % problem line
}
\end{tikzpicture}
\end{document}
问题在于绘制与节点的连接线;我收到以下错误:
ERROR: Package PGF Math Error: Unknown operator `c' or `ce' (in '0.center').
我不确定我是否以正确的方式处理这个问题或如何修复这个错误。任何帮助都将不胜感激!