KTUG 한국 텍 사용자 그룹

Menu

KTUG :: Q&A 마당

 하나만 더 질문을 드려도 될까요? 변수를 사용해 이전 좌표를 저장해뒀다가, 두 좌표를 연결하는 선을 그리고 싶습니다. 그런데 새로운 값이 저장이 안되네요. 뭐가 문제일까요?

\documentclass[]{article}
\usepackage{tikz}

\begin{document}
    \pagenumbering{gobble}
    \begin{figure}
        \begin{tikzpicture}[scale=1]
            
            \draw [->] (-1,0) --  (5,0); %x
            \draw [->] (0,0)  -- (0,5); %y
            
            \newcount\preX;
            \newcount\preY;
            \preX = 0;
            \preY = 0;
            \foreach \i in {1,...,10}{
                
                \pgfmathparse{random(1,48)}\let\res=\pgfmathresult
                \node at (0.1*\res, 0.45*\i) {$\times$};
                \draw [dotted] (0.1*\res, 0.45*\i) -- (\preX,\preY);
                \preX = 0.1*\res
                \preY = 0.45*\i
            }
            
        \end{tikzpicture}
    \end{figure}
\end{document}

KTUG 한국 텍 사용자 그룹