TikZ学習帳

筆者がマジでTikZのお勉強をするブログです。

x軸とy軸を作る

中心が原点

<script type="text/tikz">
\begin{tikzpicture}[x=3cm,y=3cm]
\node (O) at (0,0) [below left] {O};
\draw [thick, -stealth](-1.5,0)--(1.5,0) node [anchor=north]{$x$};
\draw [thick, -stealth](0,-1.2)--(0,1.2) node [anchor=east]{$y$};
\end{tikzpicture}
</script>

-stealthは「ステルス機型矢印を終点に描く」という意味。何か隠しているわけではない。

端っこが原点

<script type="text/tikz">
\begin{tikzpicture}[x=3cm,y=3cm]
\node (O) at (0,0) [below left] {O};
\draw [thick, -stealth](-0.2,0)--(2,0) node [anchor=north]{$x$};
\draw [thick, -stealth](0,-0.2)--(0,2) node [anchor=east]{$y$};
\end{tikzpicture}
</script>