【TikZ】線のかき方(draw)

このページに使用されている画像はTeXclipで作成されたものです。

# `\draw`

線をかくには次のように`\path[draw]`と`\draw`を用いた書き方があります。
下の2つは，ともに同じ図形をかきます。

```tex
\begin{tikzpicture}
	\draw (0,0)--(3,2);
\end{tikzpicture}
```



<img width=300 src="https://texclip.marutank.net/render.php/texclip20230712033334.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cdraw%20(0%2C0)--(3%2C2)%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">





```tex
\begin{tikzpicture}
	\path[draw] (0,0)--(3,2);
\end{tikzpicture}
```

<img width=300 src="https://texclip.marutank.net/render.php/texclip20230712033610.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cpath%5Bdraw%5D%20(0%2C0)--(3%2C2)%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">




`\draw`は`\path[draw]`を簡略化した命令です。以下では，`\draw`コマンドを用います。



2つの点を`--`でつなぐと，直線がかけます。

3点以上がつながった線

```tex
\begin{tikzpicture}
	\path[draw] (0,0)--(3,2)--(4,0)--(5,4);
\end{document}
```


<img width=300 src="https://texclip.marutank.net/render.php/texclip20230712033805.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cpath%5Bdraw%5D%20(0%2C0)--(3%2C2)--(4%2C0)--(5%2C4)%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">




`--`でつながない場合

```tex
\begin{document}
\begin{tikzpicture}
	\path[draw] (0,0)--(3,2) (4,0)--(5,4);
\end{tikzpicture}
\end{document}
```


<img width=300 src="https://texclip.marutank.net/render.php/texclip20230712033938.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cpath%5Bdraw%5D%20(0%2C0)--(3%2C2)%20(4%2C0)--(5%2C4)%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">







閉じた線 `cycle`を用いると，始点と終点を結びます。

```tex
\begin{document}
\begin{tikzpicture}
	\path[draw] (0,0)--(3,2) -- (4,0)--(5,4) --cycle;
\end{tikzpicture}
\end{document}
```


<img width=300 src="https://texclip.marutank.net/render.php/texclip20230712034033.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cpath%5Bdraw%5D%20(0%2C0)--(3%2C2)%20--%20(4%2C0)--(5%2C4)%20--cycle%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">




あくまで連結している点の始点と終点です。

```tex
\begin{document}
\begin{tikzpicture}
	\path[draw] (0,0)--(3,2) (4,0)--(5,4) --cycle;
\end{tikzpicture}
\end{document}
```


<img width=300 src="https://texclip.marutank.net/render.php/texclip20230712034131.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cpath%5Bdraw%5D%20(0%2C0)--(3%2C2)%20(4%2C0)--(5%2C4)%20--cycle%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">





`--`の部分を変えることで，いろいろな図形に変わります。





## `rectangle` 長方形


対角の頂点を指定することで長方形を書きます。

```tex
\begin{tikzpicture}
	\draw[very thick] (0,0) rectangle (6,4);
\end{tikzpicture}
```

<img width=300 src="https://texclip.marutank.net/render.php/texclip20230712034247.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cdraw%5Bvery%20thick%5D%20(0%2C0)%20rectangle%20(6%2C4)%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">






## `grid`

`rectangle`と同じく，対角の頂点を指定することで長方形を書き，その中にグリッドをかきます。

```tex
\begin{tikzpicture}
	\draw[very thick] (0,0) grid (6,4);
\end{tikzpicture}
```


<img width=300 src="https://texclip.marutank.net/render.php/texclip20230712034347.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cdraw%5Bvery%20thick%5D%20(0%2C0)%20grid%20(6%2C4)%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">







`grid`の幅を変えるオプションがあります。`step`, `xstep`, `ystep`で指定することができます。

`step=0.5`

```tex
 \begin{tikzpicture}
	\draw[very thick,step=.5] (0,0) grid (6,4);
  \end{tikzpicture}
```


<img width=300 src="https://texclip.marutank.net/render.php/texclip20230712034421.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cdraw%5Bvery%20thick%2Cstep%3D.5%5D%20(0%2C0)%20grid%20(6%2C4)%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">




`xstep=0.5`

```tex
 \begin{tikzpicture}
	\draw[very thick,xstep=.5] (0,0) grid (6,4);
  \end{tikzpicture}
```

<img width=300 src="https://texclip.marutank.net/render.php/texclip20230712034504.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cdraw%5Bvery%20thick%2Cxstep%3D.5%5D%20(0%2C0)%20grid%20(6%2C4)%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">



`xstep=0.5,ystep=0.7`

```tex
 \begin{tikzpicture}
	\draw[very thick,xstep=.5,ystep=.7] (0,0) grid (6,4);
  \end{tikzpicture}
```


<img width=300 src="https://texclip.marutank.net/render.php/texclip20230712034539.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cdraw%5Bvery%20thick%2Cxstep%3D.5%2Cystep%3D.7%5D%20(0%2C0)%20grid%20(6%2C4)%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">






デフォルトの状態では，座標が整数値のグリッド線がかかれます。

```tex
 \begin{tikzpicture}
	\draw[very thick] (-0.5,-0.5) grid (6.5,4.5);
	\fill (0,0) circle (2pt);
	\node[above right] at (0,0){(0,0)};
  \end{tikzpicture}
```


<img width=300 src="https://texclip.marutank.net/render.php/texclip20230712034618.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cdraw%5Bvery%20thick%5D%20(-0.5%2C-0.5)%20grid%20(6.5%2C4.5)%3B%0A%09%5Cfill%20(0%2C0)%20circle%20(2pt)%3B%0A%09%5Cnode%5Babove%20right%5D%20at%20(0%2C0)%7B(0%2C0)%7D%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">






`step`で幅を調整した場合は，必ず**原点**を通り，`step`の整数倍の位置にグリッド線がかかれます。

```tex
\begin{tikzpicture}
	\draw[very thick] (-0.5,-0.5) grid[xstep=0.7,ystep=1.2] (6.5,4.5);
	\fill (0,0) circle (2pt);
	\node[above right] at (0,0){(0,0)};
\end{tikzpicture}
```


<img width=300 src="https://texclip.marutank.net/render.php/texclip20230712034752.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cdraw%5Bvery%20thick%5D%20(-0.5%2C-0.5)%20grid%5Bxstep%3D0.7%2Cystep%3D1.2%5D%20(6.5%2C4.5)%3B%0A%09%5Cfill%20(0%2C0)%20circle%20(2pt)%3B%0A%09%5Cnode%5Babove%20right%5D%20at%20(0%2C0)%7B(0%2C0)%7D%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">







`\draw`のオプション`help lines`を入れることで，よりグリッド感が増します。

```tex
\begin{tikzpicture}
	\draw[very thick,help lines] (0,0) grid (6,4);
\end{tikzpicture}
```


<img width=300 src="https://texclip.marutank.net/render.php/texclip20230712034844.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cdraw%5Bvery%20thick%2Chelp%20lines%5D%20(0%2C0)%20grid%20(6%2C4)%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">








## タテ・ヨコの線 `|-`

タテ・ヨコ
```tex
\begin{tikzpicture}
	\draw[very thick] (0,0) |- (6,2);
\end{tikzpicture}
```

<img width=300 src="https://texclip.marutank.net/render.php/texclip20230712035017.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cdraw%5Bvery%20thick%5D%20(0%2C0)%20%7C-%20(6%2C2)%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">








ヨコ・タテ
```tex
\begin{tikzpicture}
	\draw[very thick] (0,0) -| (6,2);
\end{tikzpicture}
```

<img width=300 src="https://texclip.marutank.net/render.php/texclip20230712035109.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cdraw%5Bvery%20thick%5D%20(0%2C0)%20-%7C%20(6%2C2)%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">







## 円 `cicle`

`(座標) cicrcle (半径)`と書きます。`(座標)`は円の中心になります。

```tex
\begin{tikzpicture}
	\draw[very thick] (0,0) circle (3cm);
\end{tikzpicture}
```


<img width=250 src="https://texclip.marutank.net/render.php/texclip20230712035150.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cdraw%5Bvery%20thick%5D%20(0%2C0)%20circle%20(3cm)%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">











## 楕円

`cicrcle`とおなじ要領で書きます。楕円の場合は半径を2つ指定します。

```tex
\begin{tikzpicture}
\draw[very thick] (3,0) ellipse [x radius = 2, y radius = 1];

\draw[very thick] (8,0) ellipse [x radius = 2, y radius = 1,rotate=35];

\draw[very thick] (12,0) circle [x radius = 2, y radius = 1, rotate = 35];
\end{tikzpicture}
```


<img width=600 src="https://texclip.marutank.net/render.php/texclip20230712035247.svg?s=%5Cbegin%7Btikzpicture%7D%0A%5Cdraw%5Bvery%20thick%5D%20(3%2C0)%20ellipse%20%5Bx%20radius%20%3D%202%2C%20y%20radius%20%3D%201%5D%3B%0A%0A%5Cdraw%5Bvery%20thick%5D%20(8%2C0)%20ellipse%20%5Bx%20radius%20%3D%202%2C%20y%20radius%20%3D%201%2Crotate%3D35%5D%3B%0A%0A%0A%5Cdraw%5Bvery%20thick%5D%20(12%2C0)%20circle%20%5Bx%20radius%20%3D%202%2C%20y%20radius%20%3D%201%2C%20rotate%20%3D%2035%5D%3B%0A%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">









楕円は`circle`でもかくことができます。半径を2つ指定することで楕円になります。次の文は同じ図形になります。

```tex
\begin{tikzpicture}
\draw[very thick] (3,0) circle [x radius = 2, y radius = 1];

\draw[very thick] (8,0) circle (2 and 1);

\end{tikzpicture}
```


<img width=500 src="https://texclip.marutank.net/render.php/texclip20230712035326.svg?s=%5Cbegin%7Btikzpicture%7D%0A%5Cdraw%5Bvery%20thick%5D%20(3%2C0)%20circle%20%5Bx%20radius%20%3D%202%2C%20y%20radius%20%3D%201%5D%3B%0A%0A%5Cdraw%5Bvery%20thick%5D%20(8%2C0)%20circle%20(2%20and%201)%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">









## 少し曲げる`to`

線を少し曲げたい場合は，`--`のかわりに`to`を用いて，オプションに`[bend left]`
または，`[bend right]`をつけます。

```tex
\begin{tikzpicture}
\draw[very thick,dashed] (0,0) -- (5,0);
\draw[very thick] (0,0) to[bend left] (5,0);
\node[below right] at (0,0) {bend left};

\draw[very thick,dashed] (6,0) -- (11,0);
\draw[very thick] (6,0) to[bend right] (11,0);
\node[above right] at (6,0) {bend right};
\end{tikzpicture}
```


<img width=500 src="https://texclip.marutank.net/render.php/texclip20230712035409.svg?s=%5Cbegin%7Btikzpicture%7D%0A%5Cdraw%5Bvery%20thick%2Cdashed%5D%20(0%2C0)%20--%20(5%2C0)%3B%0A%5Cdraw%5Bvery%20thick%5D%20(0%2C0)%20to%5Bbend%20left%5D%20(5%2C0)%3B%0A%5Cnode%5Bbelow%20right%5D%20at%20(0%2C0)%20%7Bbend%20left%7D%3B%0A%0A%5Cdraw%5Bvery%20thick%2Cdashed%5D%20(6%2C0)%20--%20(11%2C0)%3B%0A%5Cdraw%5Bvery%20thick%5D%20(6%2C0)%20to%5Bbend%20right%5D%20(11%2C0)%3B%0A%5Cnode%5Babove%20right%5D%20at%20(6%2C0)%20%7Bbend%20right%7D%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">







`bend left`は，線の進行方向に対して左よりに曲がり，`bend right`はその逆です。

曲がりぐあい（直線からの離れ具合）を数値で指定できます。

```tex
\begin{tikzpicture}
\draw[very thick,dashed] (0,0) -- (5,0);
\draw[very thick] (0,0) to[bend left = 15] (5,0);
\node[below right] at (0,0) {bend left = 15};

\draw[very thick,dashed] (6,0) -- (11,0);
\draw[very thick] (6,0) to[bend left=25] (11,0);
\node[below right] at (6,0) {bend left=25};
\end{tikzpicture}
```


<img width=500 src="https://texclip.marutank.net/render.php/texclip20230712035511.svg?s=%5Cbegin%7Btikzpicture%7D%0A%5Cdraw%5Bvery%20thick%2Cdashed%5D%20(0%2C0)%20--%20(5%2C0)%3B%0A%5Cdraw%5Bvery%20thick%5D%20(0%2C0)%20to%5Bbend%20left%20%3D%2015%5D%20(5%2C0)%3B%0A%5Cnode%5Bbelow%20right%5D%20at%20(0%2C0)%20%7Bbend%20left%20%3D%2015%7D%3B%0A%0A%5Cdraw%5Bvery%20thick%2Cdashed%5D%20(6%2C0)%20--%20(11%2C0)%3B%0A%5Cdraw%5Bvery%20thick%5D%20(6%2C0)%20to%5Bbend%20left%3D25%5D%20(11%2C0)%3B%0A%5Cnode%5Bbelow%20right%5D%20at%20(6%2C0)%20%7Bbend%20left%3D25%7D%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">









# `\draw`のオプション

　太さ：`line width`
　色：`color`
　透明度：`opacity`
　形状
　矢印：`arrows`
　角：`rounded corners`
　線の端点の形状：`line cap`
　結合部分の形状：`line join`

などが設定できます。

`\draw[オプション]`と`[ ]`で指定します。複数のオプションを指定する場合は，

```tex
\draw[オプション,オプション,...]
```
のように『 `,` 』を用いて区切ります。

## 太さ

```tex
 \begin{tikzpicture}
	\draw[ultra thin] (0,3) -- (5,3) node[right] {ultra thin};
	\draw[very thin] (0,2) -- (5,2) node[right] {very thin};
	\draw[thin] (0,1) -- (5,1) node[right] {thin};
    \draw (0,0) -- (5,0) node[right] {plain};
    \draw[thick] (0,-1) -- (5,-1) node[right] {thick};
    \draw[very thick] (0,-2) -- (5,-2) node[right] {very thick};
    \draw[ultra thick] (0,-3) -- (5,-3) node[right] {ultra thick};
  \end{tikzpicture}
```


<img width=400 src="https://texclip.marutank.net/render.php/texclip20230712035850.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cdraw%5Bultra%20thin%5D%20(0%2C3)%20--%20(5%2C3)%20node%5Bright%5D%20%7Bultra%20thin%7D%3B%0A%09%5Cdraw%5Bvery%20thin%5D%20(0%2C2)%20--%20(5%2C2)%20node%5Bright%5D%20%7Bvery%20thin%7D%3B%0A%09%5Cdraw%5Bthin%5D%20(0%2C1)%20--%20(5%2C1)%20node%5Bright%5D%20%7Bthin%7D%3B%0A%20%20%20%20%5Cdraw%20(0%2C0)%20--%20(5%2C0)%20node%5Bright%5D%20%7Bplain%7D%3B%0A%20%20%20%20%5Cdraw%5Bthick%5D%20(0%2C-1)%20--%20(5%2C-1)%20node%5Bright%5D%20%7Bthick%7D%3B%0A%20%20%20%20%5Cdraw%5Bvery%20thick%5D%20(0%2C-2)%20--%20(5%2C-2)%20node%5Bright%5D%20%7Bvery%20thick%7D%3B%0A%20%20%20%20%5Cdraw%5Bultra%20thick%5D%20(0%2C-3)%20--%20(5%2C-3)%20node%5Bright%5D%20%7Bultra%20thick%7D%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">





手動で太さを設定したい場合は次のように書きます。

```tex
\begin{tikzpicture}
	\draw[line width=2pt] (0,3) -- (5,3) node[right] {2pt};
	\draw[line width=4pt] (0,2) -- (5,2) node[right] {4pt};
	\draw[line width=10pt] (0,1) -- (5,1) node[right] {10pt};
\end{tikzpicture}
```

<img width=350  src="https://texclip.marutank.net/render.php/texclip20230712040130.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cdraw%5Bline%20width%3D2pt%5D%20(0%2C3)%20--%20(5%2C3)%20node%5Bright%5D%20%7B2pt%7D%3B%0A%09%5Cdraw%5Bline%20width%3D4pt%5D%20(0%2C2)%20--%20(5%2C2)%20node%5Bright%5D%20%7B4pt%7D%3B%0A%09%5Cdraw%5Bline%20width%3D10pt%5D%20(0%2C1)%20--%20(5%2C1)%20node%5Bright%5D%20%7B10pt%7D%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">







## 色

線の色を設定できます。ここであげた色の設定は，塗りつぶしの`\fill`でも使用できます。color=`は省略できます。

```tex
\begin{tikzpicture}
    \draw[color=blue] (0,1) -- (5,1);
\end{tikzpicture}
```
<img width=400 src="https://texclip.marutank.net/render.php/texclip20230712230904.svg?s=%5Cbegin%7Btikzpicture%7D%0A%20%20%20%20%5Cdraw%5Bcolor%3Dblue%5D%20(0%2C1)%20--%20(5%2C1)%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">


使用できる色です。
```tex
\begin{tikzpicture}
    \draw[line width=4pt,red] (0,1) -- (5,1) node[right] {red};
    \draw[line width=4pt,blue] (0,0) -- (5,0) node[right] {blue};
    \draw[line width=4pt,green] (0,-1) -- (5,-1) node[right] {green};
    \draw[line width=4pt,yellow] (0,-2) -- (5,-2) node[right] {yellow};
    \draw[line width=4pt,magenta] (0,-3) -- (5,-3) node[right] {magenta};
    \draw[line width=4pt,cyan] (0,-4) -- (5,-4) node[right] {cyan};
    \draw[line width=4pt,gray] (0,-5) -- (5,-5) node[right] {black};
    \draw[line width=4pt,white] (0,-6) -- (5,-6) node[black,right] {white};
    \draw[line width=4pt,gray] (0,-7) -- (5,-7) node[right] {gray};
    \draw[line width=4pt,darkgray] (0,-8) -- (5,-8) node[right] {darkgray};
    \draw[line width=4pt,lightgray] (0,-9) -- (5,-9) node[right] {lightgray};
    \draw[line width=4pt,olive] (0,-10) -- (5,-10) node[right] {olive};
    \draw[line width=4pt,brown] (0,-11) -- (5,-11) node[right] {brown};
    \draw[line width=4pt,orange] (0,-12) -- (5,-12) node[right] {orange};
    \draw[line width=4pt,lime] (0,-13) -- (5,-13) node[right] {lime};
    \draw[line width=4pt,teal] (0,-14) -- (5,-14) node[right] {teal};
    \draw[line width=4pt,violet] (0,-15) -- (5,-15) node[right] {violet};
    \draw[line width=4pt,purple] (0,-16) -- (5,-16) node[right] {purple};
    \draw[line width=4pt,pink] (0,-17) -- (5,-17) node[right] {pink};
\end{tikzpicture}
```

<img width=400 src="https://texclip.marutank.net/render.php/texclip20230712230949.svg?s=%5Cbegin%7Btikzpicture%7D%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Cred%5D%20(0%2C1)%20--%20(5%2C1)%20node%5Bright%5D%20%7Bred%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Cblue%5D%20(0%2C0)%20--%20(5%2C0)%20node%5Bright%5D%20%7Bblue%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Cgreen%5D%20(0%2C-1)%20--%20(5%2C-1)%20node%5Bright%5D%20%7Bgreen%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Cyellow%5D%20(0%2C-2)%20--%20(5%2C-2)%20node%5Bright%5D%20%7Byellow%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Cmagenta%5D%20(0%2C-3)%20--%20(5%2C-3)%20node%5Bright%5D%20%7Bmagenta%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Ccyan%5D%20(0%2C-4)%20--%20(5%2C-4)%20node%5Bright%5D%20%7Bcyan%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Cgray%5D%20(0%2C-5)%20--%20(5%2C-5)%20node%5Bright%5D%20%7Bblack%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Cwhite%5D%20(0%2C-6)%20--%20(5%2C-6)%20node%5Bblack%2Cright%5D%20%7Bwhite%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Cgray%5D%20(0%2C-7)%20--%20(5%2C-7)%20node%5Bright%5D%20%7Bgray%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Cdarkgray%5D%20(0%2C-8)%20--%20(5%2C-8)%20node%5Bright%5D%20%7Bdarkgray%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Clightgray%5D%20(0%2C-9)%20--%20(5%2C-9)%20node%5Bright%5D%20%7Blightgray%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Colive%5D%20(0%2C-10)%20--%20(5%2C-10)%20node%5Bright%5D%20%7Bolive%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Cbrown%5D%20(0%2C-11)%20--%20(5%2C-11)%20node%5Bright%5D%20%7Bbrown%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Corange%5D%20(0%2C-12)%20--%20(5%2C-12)%20node%5Bright%5D%20%7Borange%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Clime%5D%20(0%2C-13)%20--%20(5%2C-13)%20node%5Bright%5D%20%7Blime%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Cteal%5D%20(0%2C-14)%20--%20(5%2C-14)%20node%5Bright%5D%20%7Bteal%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Cviolet%5D%20(0%2C-15)%20--%20(5%2C-15)%20node%5Bright%5D%20%7Bviolet%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Cpurple%5D%20(0%2C-16)%20--%20(5%2C-16)%20node%5Bright%5D%20%7Bpurple%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Cpink%5D%20(0%2C-17)%20--%20(5%2C-17)%20node%5Bright%5D%20%7Bpink%7D%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">




### 色を混ぜる

`blue!数値!green`とすると，左の色を数値のパーセントで

```tex
\begin{tikzpicture}
	\node[left] at (0,1){blue!100!green};
    \draw[line width=4pt,blue!100!green] (0,1) -- (5,1) node[black,right] {blue100\%, green0\%};
    \node[left] at (0,0){blue!90!green};
    \draw[line width=4pt,blue!90!green] (0,0) -- (5,0) node[black,right] {blue90\%, green10\%};
    \node[left] at (0,-1){blue!80!green};
    \draw[line width=4pt,blue!80!green] (0,-1) -- (5,-1) node[black,right] {blue80\%, green0\%};
    \node[left] at (0,-2){blue!70!green};
    \draw[line width=4pt,blue!70!green] (0,-2) -- (5,-2) node[black,right] {blue70\%, green0\%};
    \node[left] at (0,-3){blue!60!green};
    \draw[line width=4pt,blue!60!green] (0,-3) -- (5,-3) node[black,right] {blue60\%, green0\%};
    \node[left] at (0,-4){blue!50!green};
    \draw[line width=4pt,blue!50!green] (0,-4) -- (5,-4) node[black,right] {blue50\%, green0\%};
    \node[left] at (0,-5){blue!40!green};
    \draw[line width=4pt,blue!40!green] (0,-5) -- (5,-5) node[black,right] {blue40\%, green0\%};
    \node[left] at (0,-6){blue!30!green};
    \draw[line width=4pt,blue!30!green] (0,-6) -- (5,-6) node[black,right] {blue30\%, green0\%};
    \node[left] at (0,-7){blue!20!green};
    \draw[line width=4pt,blue!20!green] (0,-7) -- (5,-7) node[black,right] {blue20\%, green0\%};
    \node[left] at (0,-8){blue!10!green};
    \draw[line width=4pt,blue!10!green] (0,-8) -- (5,-8) node[black,right] {blue10\%, green0\%};
    \node[left] at (0,-9){blue!0!green};
    \draw[line width=4pt,blue!0!green] (0,-9) -- (5,-9) node[black,right] {blue0\%, green0\%};
\end{tikzpicture}
```


<img width=450 src="https://texclip.marutank.net/render.php/texclip20230712231028.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cnode%5Bleft%5D%20at%20(0%2C1)%7Bblue!100!green%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Cblue!100!green%5D%20(0%2C1)%20--%20(5%2C1)%20node%5Bblack%2Cright%5D%20%7Bblue100%5C%25%2C%20green0%5C%25%7D%3B%0A%20%20%20%20%5Cnode%5Bleft%5D%20at%20(0%2C0)%7Bblue!90!green%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Cblue!90!green%5D%20(0%2C0)%20--%20(5%2C0)%20node%5Bblack%2Cright%5D%20%7Bblue90%5C%25%2C%20green10%5C%25%7D%3B%0A%20%20%20%20%5Cnode%5Bleft%5D%20at%20(0%2C-1)%7Bblue!80!green%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Cblue!80!green%5D%20(0%2C-1)%20--%20(5%2C-1)%20node%5Bblack%2Cright%5D%20%7Bblue80%5C%25%2C%20green0%5C%25%7D%3B%0A%20%20%20%20%5Cnode%5Bleft%5D%20at%20(0%2C-2)%7Bblue!70!green%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Cblue!70!green%5D%20(0%2C-2)%20--%20(5%2C-2)%20node%5Bblack%2Cright%5D%20%7Bblue70%5C%25%2C%20green0%5C%25%7D%3B%0A%20%20%20%20%5Cnode%5Bleft%5D%20at%20(0%2C-3)%7Bblue!60!green%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Cblue!60!green%5D%20(0%2C-3)%20--%20(5%2C-3)%20node%5Bblack%2Cright%5D%20%7Bblue60%5C%25%2C%20green0%5C%25%7D%3B%0A%20%20%20%20%5Cnode%5Bleft%5D%20at%20(0%2C-4)%7Bblue!50!green%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Cblue!50!green%5D%20(0%2C-4)%20--%20(5%2C-4)%20node%5Bblack%2Cright%5D%20%7Bblue50%5C%25%2C%20green0%5C%25%7D%3B%0A%20%20%20%20%5Cnode%5Bleft%5D%20at%20(0%2C-5)%7Bblue!40!green%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Cblue!40!green%5D%20(0%2C-5)%20--%20(5%2C-5)%20node%5Bblack%2Cright%5D%20%7Bblue40%5C%25%2C%20green0%5C%25%7D%3B%0A%20%20%20%20%5Cnode%5Bleft%5D%20at%20(0%2C-6)%7Bblue!30!green%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Cblue!30!green%5D%20(0%2C-6)%20--%20(5%2C-6)%20node%5Bblack%2Cright%5D%20%7Bblue30%5C%25%2C%20green0%5C%25%7D%3B%0A%20%20%20%20%5Cnode%5Bleft%5D%20at%20(0%2C-7)%7Bblue!20!green%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Cblue!20!green%5D%20(0%2C-7)%20--%20(5%2C-7)%20node%5Bblack%2Cright%5D%20%7Bblue20%5C%25%2C%20green0%5C%25%7D%3B%0A%20%20%20%20%5Cnode%5Bleft%5D%20at%20(0%2C-8)%7Bblue!10!green%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Cblue!10!green%5D%20(0%2C-8)%20--%20(5%2C-8)%20node%5Bblack%2Cright%5D%20%7Bblue10%5C%25%2C%20green0%5C%25%7D%3B%0A%20%20%20%20%5Cnode%5Bleft%5D%20at%20(0%2C-9)%7Bblue!0!green%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Cblue!0!green%5D%20(0%2C-9)%20--%20(5%2C-9)%20node%5Bblack%2Cright%5D%20%7Bblue0%5C%25%2C%20green0%5C%25%7D%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">












## 透明度

`opacity`で透明度（不透明度）を指定することができます。0～1までの実数を用いて表します。1：不透明，0：透明を表す。透明なので，下にある青が見えています。

```tex
\begin{tikzpicture}
	\fill[blue] (2.5,1.5) rectangle (5.5,-9.5);

	\node[left] at (0,1){opacity=1};
    \draw[line width=4pt,opacity=1] (0,1) -- (5,1);
    \node[left] at (0,0){opacity=0.9};
    \draw[line width=4pt,opacity=0.9] (0,0) -- (5,0);
    \node[left] at (0,-1){opacity=0.8};
    \draw[line width=4pt,opacity=0.8] (0,-1) -- (5,-1);
    \node[left] at (0,-2){opacity=0.7};
    \draw[line width=4pt,opacity=0.7] (0,-2) -- (5,-2);
    \node[left] at (0,-3){opacity=0.6};
    \draw[line width=4pt,opacity=0.6] (0,-3) -- (5,-3);
    \node[left] at (0,-4){opacity=0.5};
    \draw[line width=4pt,opacity=0.5] (0,-4) -- (5,-4);
    \node[left] at (0,-5){opacity=0.4};
    \draw[line width=4pt,opacity=0.4] (0,-5) -- (5,-5);
    \node[left] at (0,-6){opacity=0.3};
    \draw[line width=4pt,opacity=0.3] (0,-6) -- (5,-6);
    \node[left] at (0,-7){opacity=0.2};
    \draw[line width=4pt,opacity=0.2] (0,-7) -- (5,-7);
    \node[left] at (0,-8){opacity=0.1};
    \draw[line width=4pt,opacity=0.1] (0,-8) -- (5,-8);
    \node[left] at (0,-9){opacity=0};
    \draw[line width=4pt,opacity=0] (0,-9) -- (5,-9);
\end{tikzpicture}
```

<img width=400 src="https://texclip.marutank.net/render.php/texclip20230712231136.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cfill%5Bblue%5D%20(2.5%2C1.5)%20rectangle%20(5.5%2C-9.5)%3B%0A%0A%09%5Cnode%5Bleft%5D%20at%20(0%2C1)%7Bopacity%3D1%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Copacity%3D1%5D%20(0%2C1)%20--%20(5%2C1)%3B%0A%20%20%20%20%5Cnode%5Bleft%5D%20at%20(0%2C0)%7Bopacity%3D0.9%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Copacity%3D0.9%5D%20(0%2C0)%20--%20(5%2C0)%3B%0A%20%20%20%20%5Cnode%5Bleft%5D%20at%20(0%2C-1)%7Bopacity%3D0.8%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Copacity%3D0.8%5D%20(0%2C-1)%20--%20(5%2C-1)%3B%0A%20%20%20%20%5Cnode%5Bleft%5D%20at%20(0%2C-2)%7Bopacity%3D0.7%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Copacity%3D0.7%5D%20(0%2C-2)%20--%20(5%2C-2)%3B%0A%20%20%20%20%5Cnode%5Bleft%5D%20at%20(0%2C-3)%7Bopacity%3D0.6%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Copacity%3D0.6%5D%20(0%2C-3)%20--%20(5%2C-3)%3B%0A%20%20%20%20%5Cnode%5Bleft%5D%20at%20(0%2C-4)%7Bopacity%3D0.5%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Copacity%3D0.5%5D%20(0%2C-4)%20--%20(5%2C-4)%3B%0A%20%20%20%20%5Cnode%5Bleft%5D%20at%20(0%2C-5)%7Bopacity%3D0.4%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Copacity%3D0.4%5D%20(0%2C-5)%20--%20(5%2C-5)%3B%0A%20%20%20%20%5Cnode%5Bleft%5D%20at%20(0%2C-6)%7Bopacity%3D0.3%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Copacity%3D0.3%5D%20(0%2C-6)%20--%20(5%2C-6)%3B%0A%20%20%20%20%5Cnode%5Bleft%5D%20at%20(0%2C-7)%7Bopacity%3D0.2%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Copacity%3D0.2%5D%20(0%2C-7)%20--%20(5%2C-7)%3B%0A%20%20%20%20%5Cnode%5Bleft%5D%20at%20(0%2C-8)%7Bopacity%3D0.1%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Copacity%3D0.1%5D%20(0%2C-8)%20--%20(5%2C-8)%3B%0A%20%20%20%20%5Cnode%5Bleft%5D%20at%20(0%2C-9)%7Bopacity%3D0%7D%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D4pt%2Copacity%3D0%5D%20(0%2C-9)%20--%20(5%2C-9)%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">



## 線の種類

線の種類は以下の通りです。デフォルトでは`solid`に設定されています。

```tex
\begin{tikzpicture}
	\draw[thick,solid] (0,2) -- (5,2) node[right] {solid};
    \draw[thick,dashed] (0,1) -- (5,1) node[right] {dashed};
    \draw[thick,dotted] (0,0) -- (5,0) node[right] {dotted};
    \draw[thick,dash dot] (0,-1) -- (5,-1) node[right] {dash dot};
    \draw[thick,dash dot dot] (0,-2) -- (5,-2) node[right] {dash dot dot};
    \draw[thick,dash dot dot] (0,-3) -- (5,-3) node[right] {dash dot dot dot};
    \draw[thick,double] (0,-4) -- (5,-4) node[right] {double};
\end{tikzpicture}
```

<img width=400 src="https://texclip.marutank.net/render.php/texclip20230715210158.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cdraw%5Bthick%2Csolid%5D%20(0%2C2)%20--%20(5%2C2)%20node%5Bright%5D%20%7Bsolid%7D%3B%0A%20%20%20%20%5Cdraw%5Bthick%2Cdashed%5D%20(0%2C1)%20--%20(5%2C1)%20node%5Bright%5D%20%7Bdashed%7D%3B%0A%20%20%20%20%5Cdraw%5Bthick%2Cdotted%5D%20(0%2C0)%20--%20(5%2C0)%20node%5Bright%5D%20%7Bdotted%7D%3B%0A%20%20%20%20%5Cdraw%5Bthick%2Cdash%20dot%5D%20(0%2C-1)%20--%20(5%2C-1)%20node%5Bright%5D%20%7Bdash%20dot%7D%3B%0A%20%20%20%20%5Cdraw%5Bthick%2Cdash%20dot%20dot%5D%20(0%2C-2)%20--%20(5%2C-2)%20node%5Bright%5D%20%7Bdash%20dot%20dot%7D%3B%0A%20%20%20%20%5Cdraw%5Bthick%2Cdash%20dot%20dot%5D%20(0%2C-3)%20--%20(5%2C-3)%20node%5Bright%5D%20%7Bdash%20dot%20dot%20dot%7D%3B%0A%20%20%20%20%5Cdraw%5Bthick%2Cdouble%5D%20(0%2C-4)%20--%20(5%2C-4)%20node%5Bright%5D%20%7Bdouble%7D%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">

`dot`を4つ以上つけるとエラーが出ます。




`loosely`, `densely`で間隔が調整できます。
```tex
\begin{tikzpicture}
    \draw[thick,loosely dashed] (0,1) -- (5,1) node[right] {loosely dashed};
    \draw[thick,dashed] (0,0) -- (5,0) node[right] {dashed};
    \draw[thick,densely dashed] (0,-1) -- (5,-1) node[right] {densely dashed};
\end{tikzpicture}
```

<img width=400 src="https://texclip.marutank.net/render.php/texclip20230712231643.svg?s=%5Cbegin%7Btikzpicture%7D%0A%20%20%20%20%5Cdraw%5Bthick%2Cloosely%20dashed%5D%20(0%2C1)%20--%20(5%2C1)%20node%5Bright%5D%20%7Bloosely%20dashed%7D%3B%0A%20%20%20%20%5Cdraw%5Bthick%2Cdashed%5D%20(0%2C0)%20--%20(5%2C0)%20node%5Bright%5D%20%7Bdashed%7D%3B%0A%20%20%20%20%5Cdraw%5Bthick%2Cdensely%20dashed%5D%20(0%2C-1)%20--%20(5%2C-1)%20node%5Bright%5D%20%7Bdensely%20dashed%7D%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">

```tex
\begin{tikzpicture}
    \draw[thick,loosely dotted] (0,1) -- (5,1) node[right] {loosely dotted};
    \draw[thick,dotted] (0,0) -- (5,0) node[right] {dotted};
    \draw[thick,densely dotted] (0,-1) -- (5,-1) node[right] {densely dotted};
\end{tikzpicture}
```

<img width=400 src="https://texclip.marutank.net/render.php/texclip20230712231710.svg?s=%5Cbegin%7Btikzpicture%7D%0A%20%20%20%20%5Cdraw%5Bthick%2Cloosely%20dotted%5D%20(0%2C1)%20--%20(5%2C1)%20node%5Bright%5D%20%7Bloosely%20dotted%7D%3B%0A%20%20%20%20%5Cdraw%5Bthick%2Cdotted%5D%20(0%2C0)%20--%20(5%2C0)%20node%5Bright%5D%20%7Bdotted%7D%3B%0A%20%20%20%20%5Cdraw%5Bthick%2Cdensely%20dotted%5D%20(0%2C-1)%20--%20(5%2C-1)%20node%5Bright%5D%20%7Bdensely%20dotted%7D%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">

```tex
\begin{tikzpicture}
    \draw[thick,loosely dash dot] (0,1) -- (5,1) node[right] {loosely dash dot};
    \draw[thick,dash dot] (0,0) -- (5,0) node[right] {dash dot};
    \draw[thick,densely dash dot] (0,-1) -- (5,-1) node[right] {densely dash dot};
\end{tikzpicture}
```

<img width=400 src="https://texclip.marutank.net/render.php/texclip20230712231828.svg?s=%5Cbegin%7Btikzpicture%7D%0A%20%20%20%20%5Cdraw%5Bthick%2Cloosely%20dash%20dot%5D%20(0%2C1)%20--%20(5%2C1)%20node%5Bright%5D%20%7Bloosely%20dash%20dot%7D%3B%0A%20%20%20%20%5Cdraw%5Bthick%2Cdash%20dot%5D%20(0%2C0)%20--%20(5%2C0)%20node%5Bright%5D%20%7Bdash%20dot%7D%3B%0A%20%20%20%20%5Cdraw%5Bthick%2Cdensely%20dash%20dot%5D%20(0%2C-1)%20--%20(5%2C-1)%20node%5Bright%5D%20%7Bdensely%20dash%20dot%7D%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">

dotは3個以上では変わらないみたい。








## 矢印　端点の形状`arrows`

`atrrows=->`のようにすると矢印がかけます。`arrows`は省略できます。始点と終点に矢印をつけることができます。

線の太さによる違い
```tex
\begin{tikzpicture}
	\draw[arrows=->] (0,1) -- (5,1) node[right] {\verb|->|};
    \draw[thick, ->] (0,0) -- (5,0) node[right] {\verb|->|};
    \draw[very thick,->] (0,-1) -- (5,-1) node[right]{\verb|->|};
    \draw[ultra thick,->] (0,-2) -- (5,-2)node[right]{\verb|->|};
\end{tikzpicture}
```

<img width=350 src="https://texclip.marutank.net/render.php/texclip20230712232102.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cdraw%5Barrows%3D-%3E%5D%20(0%2C1)%20--%20(5%2C1)%20node%5Bright%5D%20%7B%5Cverb%7C-%3E%7C%7D%3B%0A%20%20%20%20%5Cdraw%5Bthick%2C%20-%3E%5D%20(0%2C0)%20--%20(5%2C0)%20node%5Bright%5D%20%7B%5Cverb%7C-%3E%7C%7D%3B%0A%20%20%20%20%5Cdraw%5Bvery%20thick%2C-%3E%5D%20(0%2C-1)%20--%20(5%2C-1)%20node%5Bright%5D%7B%5Cverb%7C-%3E%7C%7D%3B%0A%20%20%20%20%5Cdraw%5Bultra%20thick%2C-%3E%5D%20(0%2C-2)%20--%20(5%2C-2)node%5Bright%5D%7B%5Cverb%7C-%3E%7C%7D%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">

形状
normal

```tex
\begin{tikzpicture}
	\draw[very thick,->] (0,1) -- (5,1) node[right] {\verb|->|};
    \draw[very thick, <-] (0,0) -- (5,0) node[right] {\verb|<-|};
    \draw[very thick,<->] (0,-1) -- (5,-1) node[right]{\verb|<->|};
\end{tikzpicture}
```

<img width=350 src="https://texclip.marutank.net/render.php/texclip20230712232135.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cdraw%5Bvery%20thick%2C-%3E%5D%20(0%2C1)%20--%20(5%2C1)%20node%5Bright%5D%20%7B%5Cverb%7C-%3E%7C%7D%3B%0A%20%20%20%20%5Cdraw%5Bvery%20thick%2C%20%3C-%5D%20(0%2C0)%20--%20(5%2C0)%20node%5Bright%5D%20%7B%5Cverb%7C%3C-%7C%7D%3B%0A%20%20%20%20%5Cdraw%5Bvery%20thick%2C%3C-%3E%5D%20(0%2C-1)%20--%20(5%2C-1)%20node%5Bright%5D%7B%5Cverb%7C%3C-%3E%7C%7D%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">

2重
```tex
\begin{tikzpicture}
	\draw[very thick,->>] (0,1) -- (5,1) node[right] {\verb|->>|};
    \draw[very thick, <<-] (0,0) -- (5,0) node[right] {\verb|<<-|};
    \draw[very thick,<<->>] (0,-1) -- (5,-1) node[right]{\verb|<<->>|};
\end{tikzpicture}
```

<img width=350 src="https://texclip.marutank.net/render.php/texclip20230712232217.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cdraw%5Bvery%20thick%2C-%3E%3E%5D%20(0%2C1)%20--%20(5%2C1)%20node%5Bright%5D%20%7B%5Cverb%7C-%3E%3E%7C%7D%3B%0A%20%20%20%20%5Cdraw%5Bvery%20thick%2C%20%3C%3C-%5D%20(0%2C0)%20--%20(5%2C0)%20node%5Bright%5D%20%7B%5Cverb%7C%3C%3C-%7C%7D%3B%0A%20%20%20%20%5Cdraw%5Bvery%20thick%2C%3C%3C-%3E%3E%5D%20(0%2C-1)%20--%20(5%2C-1)%20node%5Bright%5D%7B%5Cverb%7C%3C%3C-%3E%3E%7C%7D%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">

逆向き
```tex
\begin{tikzpicture}
	\draw[very thick,-<] (0,1) -- (5,1) node[right] {\verb|-<|};
    \draw[very thick, >-] (0,0) -- (5,0) node[right] {\verb|>-|};
    \draw[very thick,>-<] (0,-1) -- (5,-1) node[right]{\verb|>-<|};
\end{tikzpicture}
```
<img width=350 src="https://texclip.marutank.net/render.php/texclip20230712232506.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cdraw%5Bvery%20thick%2C-%3C%5D%20(0%2C1)%20--%20(5%2C1)%20node%5Bright%5D%20%7B%5Cverb%7C-%3C%7C%7D%3B%0A%20%20%20%20%5Cdraw%5Bvery%20thick%2C%20%3E-%5D%20(0%2C0)%20--%20(5%2C0)%20node%5Bright%5D%20%7B%5Cverb%7C%3E-%7C%7D%3B%0A%20%20%20%20%5Cdraw%5Bvery%20thick%2C%3E-%3C%5D%20(0%2C-1)%20--%20(5%2C-1)%20node%5Bright%5D%7B%5Cverb%7C%3E-%3C%7C%7D%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">




```tex
\begin{tikzpicture}
	\draw[very thick,-<<] (0,1) -- (5,1) node[right] {\verb|-<<|};
    \draw[very thick, >>-] (0,0) -- (5,0) node[right] {\verb|>>-|};
    \draw[very thick,>>-<<] (0,-1) -- (5,-1) node[right]{\verb|>>-<<|};
\end{tikzpicture}
```

<img width=350 src="https://texclip.marutank.net/render.php/texclip20230712232545.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cdraw%5Bvery%20thick%2C-%3C%3C%5D%20(0%2C1)%20--%20(5%2C1)%20node%5Bright%5D%20%7B%5Cverb%7C-%3C%3C%7C%7D%3B%0A%20%20%20%20%5Cdraw%5Bvery%20thick%2C%20%3E%3E-%5D%20(0%2C0)%20--%20(5%2C0)%20node%5Bright%5D%20%7B%5Cverb%7C%3E%3E-%7C%7D%3B%0A%20%20%20%20%5Cdraw%5Bvery%20thick%2C%3E%3E-%3C%3C%5D%20(0%2C-1)%20--%20(5%2C-1)%20node%5Bright%5D%7B%5Cverb%7C%3E%3E-%3C%3C%7C%7D%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">


latex
```tex
\begin{tikzpicture}
	\draw[very thick,-latex] (0,1) -- (5,1) node[right] {\verb|-latex|};
    \draw[very thick, latex-] (0,0) -- (5,0) node[right] {\verb|latex-|};
    \draw[very thick,latex-latex] (0,-1) -- (5,-1) node[right]{\verb|latex-latex|};
\end{tikzpicture}
```

<img width=400 src="https://texclip.marutank.net/render.php/texclip20230712232613.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cdraw%5Bvery%20thick%2C-latex%5D%20(0%2C1)%20--%20(5%2C1)%20node%5Bright%5D%20%7B%5Cverb%7C-latex%7C%7D%3B%0A%20%20%20%20%5Cdraw%5Bvery%20thick%2C%20latex-%5D%20(0%2C0)%20--%20(5%2C0)%20node%5Bright%5D%20%7B%5Cverb%7Clatex-%7C%7D%3B%0A%20%20%20%20%5Cdraw%5Bvery%20thick%2Clatex-latex%5D%20(0%2C-1)%20--%20(5%2C-1)%20node%5Bright%5D%7B%5Cverb%7Clatex-latex%7C%7D%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">




stealth
```tex
\begin{tikzpicture}
	\draw[very thick,-stealth] (0,1) -- (5,1) node[right] {\verb|-stealth|};
    \draw[very thick, stealth-] (0,0) -- (5,0) node[right] {\verb|stealth-|};
    \draw[very thick,stealth-stealth] (0,-1) -- (5,-1) node[right]{\verb|stealth-stealth|};
\end{tikzpicture}
```

<img width=400 src="https://texclip.marutank.net/render.php/texclip20230712232642.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cdraw%5Bvery%20thick%2C-stealth%5D%20(0%2C1)%20--%20(5%2C1)%20node%5Bright%5D%20%7B%5Cverb%7C-stealth%7C%7D%3B%0A%20%20%20%20%5Cdraw%5Bvery%20thick%2C%20stealth-%5D%20(0%2C0)%20--%20(5%2C0)%20node%5Bright%5D%20%7B%5Cverb%7Cstealth-%7C%7D%3B%0A%20%20%20%20%5Cdraw%5Bvery%20thick%2Cstealth-stealth%5D%20(0%2C-1)%20--%20(5%2C-1)%20node%5Bright%5D%7B%5Cverb%7Cstealth-stealth%7C%7D%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">


矢印の先端にはオプションで色を付けることができます。
オプションに書くとき，`{latex[red]}`のように中カッコをつける必要があります。
```tex
\begin{tikzpicture}
	\draw[very thick,-{>[red]}] (0,1) -- (5,1) node[right] {\verb|-{>[red]}|};
    \draw[very thick, -{>>[red]}] (0,0) -- (5,0) node[right] {\verb|-{>>[red]}|};
    \draw[very thick,-{<[red]}] (0,-1) -- (5,-1) node[right]{\verb|-{<[red]}|};
    \draw[very thick,-{<<[red]}] (0,-2) -- (5,-2) node[right]{\verb|-{<<[red]}|};
    \draw[very thick,-{latex[red]}] (0,-3) -- (5,-3) node[right]{\verb|-{latex[red]}|};
    \draw[very thick,-{stealth[red]}] (0,-4) -- (5,-4) node[right]{\verb|-{stealth[red]}|};
\end{tikzpicture}
```

<img width=400 src="https://texclip.marutank.net/render.php/texclip20230712232730.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cdraw%5Bvery%20thick%2C-%7B%3E%5Bred%5D%7D%5D%20(0%2C1)%20--%20(5%2C1)%20node%5Bright%5D%20%7B%5Cverb%7C-%7B%3E%5Bred%5D%7D%7C%7D%3B%0A%20%20%20%20%5Cdraw%5Bvery%20thick%2C%20-%7B%3E%3E%5Bred%5D%7D%5D%20(0%2C0)%20--%20(5%2C0)%20node%5Bright%5D%20%7B%5Cverb%7C-%7B%3E%3E%5Bred%5D%7D%7C%7D%3B%0A%20%20%20%20%5Cdraw%5Bvery%20thick%2C-%7B%3C%5Bred%5D%7D%5D%20(0%2C-1)%20--%20(5%2C-1)%20node%5Bright%5D%7B%5Cverb%7C-%7B%3C%5Bred%5D%7D%7C%7D%3B%0A%20%20%20%20%5Cdraw%5Bvery%20thick%2C-%7B%3C%3C%5Bred%5D%7D%5D%20(0%2C-2)%20--%20(5%2C-2)%20node%5Bright%5D%7B%5Cverb%7C-%7B%3C%3C%5Bred%5D%7D%7C%7D%3B%0A%20%20%20%20%5Cdraw%5Bvery%20thick%2C-%7Blatex%5Bred%5D%7D%5D%20(0%2C-3)%20--%20(5%2C-3)%20node%5Bright%5D%7B%5Cverb%7C-%7Blatex%5Bred%5D%7D%7C%7D%3B%0A%20%20%20%20%5Cdraw%5Bvery%20thick%2C-%7Bstealth%5Bred%5D%7D%5D%20(0%2C-4)%20--%20(5%2C-4)%20node%5Bright%5D%7B%5Cverb%7C-%7Bstealth%5Bred%5D%7D%7C%7D%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">

`latex`,`stealth`の矢じりを逆向きにすることができます。

```tex
\begin{tikzpicture}
	\draw[very thick,-{latex[reversed]}] (0,1) -- (5,1) node[right] {\verb|-{latex[reversed]}|};
    \draw[very thick, -{stealth[reversed]}] (0,0) -- (5,0) node[right] {\verb|-{stealth[reversed]}|};
\end{tikzpicture}
```


<img width=400 src="https://texclip.marutank.net/render.php/texclip20230712232851.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cdraw%5Bvery%20thick%2C-%7Blatex%5Breversed%5D%7D%5D%20(0%2C1)%20--%20(5%2C1)%20node%5Bright%5D%20%7B%5Cverb%7C-%7Blatex%5Breversed%5D%7D%7C%7D%3B%0A%20%20%20%20%5Cdraw%5Bvery%20thick%2C%20-%7Bstealth%5Breversed%5D%7D%5D%20(0%2C0)%20--%20(5%2C0)%20node%5Bright%5D%20%7B%5Cverb%7C-%7Bstealth%5Breversed%5D%7D%7C%7D%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">




## 角`rounded corners`

角の部分を丸くします。

```tex
\begin{tikzpicture}
	\draw[very thick,rounded corners = 5pt] (0,0) -- (2,2) -- (3,0) ;
    \draw[very thick,rounded corners = 20pt] (4,0) -- (6,2) -- (7,0) ;
\end{tikzpicture}
```

<img width=450 src="https://texclip.marutank.net/render.php/texclip20230712233453.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cdraw%5Bvery%20thick%2Crounded%20corners%20%3D%205pt%5D%20(0%2C0)%20--%20(2%2C2)%20--%20(3%2C0)%20%3B%0A%20%20%20%20%5Cdraw%5Bvery%20thick%2Crounded%20corners%20%3D%2020pt%5D%20(4%2C0)%20--%20(6%2C2)%20--%20(7%2C0)%20%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">








## 線の端点の形状：line cap

```tex
\begin{tikzpicture}
	\draw[line width=6pt] (0,0) -- (2,2) -- (3,0) ;
    \draw[line width=6pt,line cap=butt] (4,0) -- (6,2) -- (7,0) ;
    \draw[line width=6pt, line cap=rect] (8,0) -- (10,2) -- (11,0) ;
	\draw[line width=6pt, line cap=round] (12,0) -- (14,2) -- (15,0) ;
\end{tikzpicture}
```

<img width = 600 src="https://texclip.marutank.net/render.php/texclip20230712233841.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cdraw%5Bline%20width%3D6pt%5D%20(0%2C0)%20--%20(2%2C2)%20--%20(3%2C0)%20%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D6pt%2Cline%20cap%3Dbutt%5D%20(4%2C0)%20--%20(6%2C2)%20--%20(7%2C0)%20%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D6pt%2C%20line%20cap%3Drect%5D%20(8%2C0)%20--%20(10%2C2)%20--%20(11%2C0)%20%3B%0A%09%5Cdraw%5Bline%20width%3D6pt%2C%20line%20cap%3Dround%5D%20(12%2C0)%20--%20(14%2C2)%20--%20(15%2C0)%20%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">









## 線の結合部分の形状
```tex
\begin{tikzpicture}
	\draw[line width=6pt] (0,0) -- (2,2) -- (3,0) ;
    \draw[line width=6pt,line join=miter] (4,0) -- (6,2) -- (7,0) ;
    \draw[line width=6pt, line join=round] (8,0) -- (10,2) -- (11,0) ;
	\draw[line width=6pt, line join=bevel] (12,0) -- (14,2) -- (15,0) ;
\end{tikzpicture}
```

<img width = 600 src="https://texclip.marutank.net/render.php/texclip20230712234025.svg?s=%5Cbegin%7Btikzpicture%7D%0A%09%5Cdraw%5Bline%20width%3D6pt%5D%20(0%2C0)%20--%20(2%2C2)%20--%20(3%2C0)%20%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D6pt%2Cline%20join%3Dmiter%5D%20(4%2C0)%20--%20(6%2C2)%20--%20(7%2C0)%20%3B%0A%20%20%20%20%5Cdraw%5Bline%20width%3D6pt%2C%20line%20join%3Dround%5D%20(8%2C0)%20--%20(10%2C2)%20--%20(11%2C0)%20%3B%0A%09%5Cdraw%5Bline%20width%3D6pt%2C%20line%20join%3Dbevel%5D%20(12%2C0)%20--%20(14%2C2)%20--%20(15%2C0)%20%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=300&m=s&b=f&k=f">

























<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
processEscapes: true
}
});
</script>
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>


<link rel="stylesheet" type="text/css" href="https://tikzjax.com/v1/fonts.css">
<script src="https://tikzjax.com/v1/tikzjax.js"></script>