Matplotlibで日本語表示
matplotlib-fontjaで日本語表示に対応する.
matplotlibで日本語フォントを使う準備¶
# matplotlibで日本語フォントを使う準備1
# matplotlib-fontjaのインストール
!pip install matplotlib-fontjaCollecting matplotlib-fontja
Downloading matplotlib_fontja-1.1.0-py2.py3-none-any.whl.metadata (5.7 kB)
Collecting matplotlib (from matplotlib-fontja)
Downloading matplotlib-3.10.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (11 kB)
Collecting contourpy>=1.0.1 (from matplotlib->matplotlib-fontja)
Downloading contourpy-1.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (5.5 kB)
Collecting cycler>=0.10 (from matplotlib->matplotlib-fontja)
Downloading cycler-0.12.1-py3-none-any.whl.metadata (3.8 kB)
Collecting fonttools>=4.22.0 (from matplotlib->matplotlib-fontja)
Downloading fonttools-4.59.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (107 kB)
Collecting kiwisolver>=1.3.1 (from matplotlib->matplotlib-fontja)
Downloading kiwisolver-1.4.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.2 kB)
Collecting numpy>=1.23 (from matplotlib->matplotlib-fontja)
Downloading numpy-2.3.1-cp311-cp311-manylinux_2_28_x86_64.whl.metadata (62 kB)
Collecting packaging>=20.0 (from matplotlib->matplotlib-fontja)
Downloading packaging-25.0-py3-none-any.whl.metadata (3.3 kB)
Collecting pillow>=8 (from matplotlib->matplotlib-fontja)
Downloading pillow-11.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.metadata (9.0 kB)
Collecting pyparsing>=2.3.1 (from matplotlib->matplotlib-fontja)
Downloading pyparsing-3.2.3-py3-none-any.whl.metadata (5.0 kB)
Collecting python-dateutil>=2.7 (from matplotlib->matplotlib-fontja)
Downloading python_dateutil-2.9.0.post0-py2.py3-none-any.whl.metadata (8.4 kB)
Collecting six>=1.5 (from python-dateutil>=2.7->matplotlib->matplotlib-fontja)
Downloading six-1.17.0-py2.py3-none-any.whl.metadata (1.7 kB)
Downloading matplotlib_fontja-1.1.0-py2.py3-none-any.whl (4.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/4.2 MB ? eta -:--:-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.2/4.2 MB 22.9 MB/s eta 0:00:00
Downloading matplotlib-3.10.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/8.6 MB ? eta -:--:-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╸━ 8.4/8.6 MB 39.1 MB/s eta 0:00:01 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.6/8.6 MB 24.4 MB/s eta 0:00:00
Downloading contourpy-1.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (326 kB)
Downloading cycler-0.12.1-py3-none-any.whl (8.3 kB)
Downloading fonttools-4.59.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (5.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/5.0 MB ? eta -:--:-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.0/5.0 MB 25.0 MB/s eta 0:00:00
Downloading kiwisolver-1.4.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/1.4 MB ? eta -:--:-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 19.0 MB/s eta 0:00:00
Downloading numpy-2.3.1-cp311-cp311-manylinux_2_28_x86_64.whl (16.9 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/16.9 MB ? eta -:--:-- ━━━━━━━━━━━━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━ 7.1/16.9 MB 37.0 MB/s eta 0:00:01 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╸━━ 16.0/16.9 MB 38.6 MB/s eta 0:00:01 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 16.9/16.9 MB 26.7 MB/s eta 0:00:00
Downloading packaging-25.0-py3-none-any.whl (66 kB)
Downloading pillow-11.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/6.6 MB ? eta -:--:-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺ 6.6/6.6 MB 35.4 MB/s eta 0:00:01 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.6/6.6 MB 23.4 MB/s eta 0:00:00
Downloading pyparsing-3.2.3-py3-none-any.whl (111 kB)
Downloading python_dateutil-2.9.0.post0-py2.py3-none-any.whl (229 kB)
Downloading six-1.17.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: six, pyparsing, pillow, packaging, numpy, kiwisolver, fonttools, cycler, python-dateutil, contourpy, matplotlib, matplotlib-fontja
━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/12 [pyparsing] ━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/12 [pyparsing] ━━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/12 [pillow] ━━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/12 [pillow] ━━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/12 [pillow] ━━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/12 [pillow] ━━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/12 [pillow] ━━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/12 [pillow] ━━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/12 [pillow] ━━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/12 [pillow] ━━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/12 [pillow] ━━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/12 [pillow] ━━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/12 [pillow] ━━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/12 [pillow] ━━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/12 [pillow] ━━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/12 [pillow] ━━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/12 [pillow] ━━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/12 [pillow] ━━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/12 [pillow] ━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3/12 [packaging] ━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3/12 [packaging] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 4/12 [numpy] ━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━ 6/12 [fonttools] ━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━ 6/12 [fonttools] ━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━ 6/12 [fonttools] ━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━ 6/12 [fonttools] ━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━ 6/12 [fonttools] ━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━ 6/12 [fonttools] ━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━ 6/12 [fonttools] ━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━ 6/12 [fonttools] ━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━ 6/12 [fonttools] ━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━ 6/12 [fonttools] ━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━ 6/12 [fonttools] ━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━ 6/12 [fonttools] ━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━ 6/12 [fonttools] ━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━ 6/12 [fonttools] ━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━ 6/12 [fonttools] ━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━ 6/12 [fonttools] ━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━ 6/12 [fonttools] ━━━━━━━━━━━━━━━━━━━━━━━━━━╸━━━━━━━━━━━━━ 8/12 [python-dateutil] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━ 9/12 [contourpy] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━ 10/12 [matplotlib] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━ 10/12 [matplotlib] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━ 10/12 [matplotlib] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━ 10/12 [matplotlib] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━ 10/12 [matplotlib] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━ 10/12 [matplotlib] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━ 10/12 [matplotlib] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━ 10/12 [matplotlib] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━ 10/12 [matplotlib] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━ 10/12 [matplotlib] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━ 10/12 [matplotlib] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━ 10/12 [matplotlib] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━ 10/12 [matplotlib] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━ 10/12 [matplotlib] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━ 10/12 [matplotlib] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━ 10/12 [matplotlib] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━ 10/12 [matplotlib] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━ 10/12 [matplotlib] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━ 10/12 [matplotlib] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━ 10/12 [matplotlib] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━ 10/12 [matplotlib] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━ 10/12 [matplotlib] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━ 10/12 [matplotlib] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╸━━━ 11/12 [matplotlib-fontja] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12/12 [matplotlib-fontja]
Successfully installed contourpy-1.3.2 cycler-0.12.1 fonttools-4.59.0 kiwisolver-1.4.8 matplotlib-3.10.3 matplotlib-fontja-1.1.0 numpy-2.3.1 packaging-25.0 pillow-11.3.0 pyparsing-3.2.3 python-dateutil-2.9.0.post0 six-1.17.0
# matplotlibで日本語フォントを使う準備2
# matplotlibとともにjapanize_matplotlibを読み込む
import matplotlib.pyplot as plt
import matplotlib_fontjamatplotlib_fontjaの読み込みはmatplotlibの後に行う必要がある.
離散指数増殖モデル¶
# 離散指数増殖モデル
a = 0.1
x = 1
t = 0
t_list = [t]
x_list = [x]
for i in range(100):
t = t + 1
x = x + a * x
t_list.append(t)
x_list.append(x)# タイトル・軸ラベル(日本語)
plt.plot(t_list, x_list)
plt.title("指数増殖")
plt.xlabel("時刻 (t)")
plt.ylabel("集団サイズ (x)")