patternsライブラリ

`\usetikzlibrary{patterns}`

TikZjax×
TeXclip○
obsidian×

patterns ライブラリで次のような塗りつぶしがかけます。

```tex
\begin{tikzpicture}
\fill[pattern=north west lines] (0,0) rectangle (3,4);
\end{tikzpicture}
```

![](https://www.evernote.com/shard/s225/sh/7e85717f-e29e-4d60-a1c2-9aa5870fd72b/ce23989a2394582bcc78c8dcf7e97dd6/res/25e7bd2f-cd09-4cb9-b79e-e1b61dae7a0c)




`\fill`, `\draw`, `\path`のオプションに入れます。パターンの背景は透明です。

![](https://texclip.marutank.net/render.php/texclip20230716062137.svg?s=%5Cusetikzlibrary%7Bpatterns%7D%0A%5Cbegin%7Btikzpicture%7D%0A%20%20%20%20%5Cfill%5Bblue%5D%20(2%2C0)%20rectangle%20(4%2C3)%3B%0A%09%5Cfill%5Bpattern%3Dnorth%20west%20lines%5D%20(0%2C0)%20rectangle%20(4%2C3)%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=600&m=s&b=f&k=f)

**TeXclipソースコード**

https://texclip.marutank.net/#s=%5Cusetikzlibrary%7Bpatterns%7D%0A%5Cbegin%7Btikzpicture%7D%0A%20%20%20%20%5Cfill%5Bblue%5D%20(2%2C0)%20rectangle%20(4%2C3)%3B%0A%09%5Cfill%5Bpattern%3Dnorth%20west%20lines%5D%20(0%2C0)%20rectangle%20(4%2C3)%3B%0A%5Cend%7Btikzpicture%7D



# パターン

`pattern=north west lines`
![](https://www.evernote.com/shard/s225/sh/7e85717f-e29e-4d60-a1c2-9aa5870fd72b/ce23989a2394582bcc78c8dcf7e97dd6/res/25e7bd2f-cd09-4cb9-b79e-e1b61dae7a0c)


`pattern=north east lines`
![](https://www.evernote.com/shard/s225/sh/7e85717f-e29e-4d60-a1c2-9aa5870fd72b/ce23989a2394582bcc78c8dcf7e97dd6/res/5587380a-1eb1-4535-90af-f19d656d76e6)

`pattern=horizontal lines`
![](https://www.evernote.com/shard/s225/sh/7e85717f-e29e-4d60-a1c2-9aa5870fd72b/ce23989a2394582bcc78c8dcf7e97dd6/res/3c0e0c9c-5402-4444-8aa9-32b79b93c83d)



`pattern=vertical lines`
![](https://www.evernote.com/shard/s225/sh/7e85717f-e29e-4d60-a1c2-9aa5870fd72b/ce23989a2394582bcc78c8dcf7e97dd6/res/578c7369-14e8-4adb-beca-db2779a1ee0d)



`pattern=grid`
<img width=300 src="https://texclip.marutank.net/render.php/texclip20230715224122.svg?s=%5Cusetikzlibrary%7Bpatterns%7D%0A%5Cbegin%7Btikzpicture%7D%0A%09%5Cfill%5Bpattern%3Dgrid%5D%20(0%2C0)%20rectangle%20(4%2C3)%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=600&m=s&b=f&k=f">




`pattern=crosshatch`
<img width=300 src="https://texclip.marutank.net/render.php/texclip20230715224526.svg?s=%5Cusetikzlibrary%7Bpatterns%7D%0A%5Cbegin%7Btikzpicture%7D%0A%09%5Cfill%5Bpattern%3Dcrosshatch%5D%20(0%2C0)%20rectangle%20(4%2C3)%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=600&m=s&b=f&k=f">


`pattern=dots`
<img width=300 src="https://texclip.marutank.net/render.php/texclip20230715224636.svg?s=%5Cusetikzlibrary%7Bpatterns%7D%0A%5Cbegin%7Btikzpicture%7D%0A%09%5Cfill%5Bpattern%3Ddots%5D%20(0%2C0)%20rectangle%20(4%2C3)%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=600&m=s&b=f&k=f">





`pattern=crosshatch dots`
<img width=300 src="https://texclip.marutank.net/render.php/texclip20230715224804.svg?s=%5Cusetikzlibrary%7Bpatterns%7D%0A%5Cbegin%7Btikzpicture%7D%0A%09%5Cfill%5Bpattern%3Dcrosshatch%20dots%5D%20(0%2C0)%20rectangle%20(4%2C3)%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=600&m=s&b=f&k=f">





`pattern=fivepointed stars`
<img width=300 src="https://texclip.marutank.net/render.php/texclip20230715224950.svg?s=%5Cusetikzlibrary%7Bpatterns%7D%0A%5Cbegin%7Btikzpicture%7D%0A%09%5Cfill%5Bpattern%3Dfivepointed%20stars%5D%20(0%2C0)%20rectangle%20(4%2C3)%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=600&m=s&b=f&k=f">






`pattern=sixpointed stars`
<img width=300 src="https://texclip.marutank.net/render.php/texclip20230715225053.svg?s=%5Cusetikzlibrary%7Bpatterns%7D%0A%5Cbegin%7Btikzpicture%7D%0A%09%5Cfill%5Bpattern%3Dsixpointed%20stars%5D%20(0%2C0)%20rectangle%20(4%2C3)%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=600&m=s&b=f&k=f">


`pattern=bricks`
<img width=300 src="https://texclip.marutank.net/render.php/texclip20230715225318.svg?s=%5Cusetikzlibrary%7Bpatterns%7D%0A%5Cbegin%7Btikzpicture%7D%0A%09%5Cfill%5Bpattern%3Dbricks%5D%20(0%2C0)%20rectangle%20(4%2C3)%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=600&m=s&b=f&k=f">






`pattern=checkerboard`
<img width=300 src="https://texclip.marutank.net/render.php/texclip20230715225735.svg?s=%5Cusetikzlibrary%7Bpatterns%7D%0A%5Cbegin%7Btikzpicture%7D%0A%09%5Cfill%5Bpattern%3Dcheckerboard%5D%20(0%2C0)%20rectangle%20(4%2C3)%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=600&m=s&b=f&k=f">




# 色

`pattern color=`オプションを指定して，パターンに色を付けることができます。

```tex
\usetikzlibrary{patterns}
\begin{tikzpicture}
	\fill[pattern=checkerboard,pattern color=red] (0,0) rectangle (4,3);
\end{tikzpicture}
```

<img width=300 src="https://texclip.marutank.net/render.php/texclip20230715230202.svg?s=%5Cusetikzlibrary%7Bpatterns%7D%0A%5Cbegin%7Btikzpicture%7D%0A%09%5Cfill%5Bpattern%3Dcheckerboard%2Cpattern%20color%3Dred%5D%20(0%2C0)%20rectangle%20(4%2C3)%3B%0A%5Cend%7Btikzpicture%7D&f=c&r=600&m=s&b=f&k=f">