2  Meiryo fontのセットアップ

Author

Ryo Nakagami

Published

2025-07-23

Modified

2025-07-28

Linux環境でのMeiryo Font設定

Linux OSの場合,.local/share/fonts以下に以下のMeiryoフォントをインストールします.

Fonts File Explanation
Meiryo meiryo.ttc Meiryo UI Regular, Meiryo UI Italic, Meiryo Regular, Meiryo Italic
meiryob.ttc Meiryo UI Bold, Meiryo UI Bold Italic, Meiryo Bold, Meiryo Bold Italic

環境要件

  • Linux operating system(Ubuntuを含む)
  • fc-cache コマンド
    • MacOsで実行する場合は, brew install ricty を実行することでfc-cache コマンドが利用可能になります

手順

# download repository
git clone https://github.com/yourusername/ManualFontInstaller.git
cd ManualFontInstaller

# Run script
./install_fonts.sh

Meiryoフォントを用いた可視化

Plotly

import plotly.express as px

fig = px.scatter(x=[1, 2, 3], y=[4, 5, 6], title="サンプルグラフ")

# X軸ラベルの追加
fig.update_layout(
    xaxis_title="時間(秒)",  # ← ここがX軸ラベル
    font=dict(family="Meiryo")
)

fig.show()

Matplotlib

import matplotlib.pyplot as plt

plt.rcParams["font.family"] = "Meiryo"

x = [1, 2, 3]
y = [4, 5, 6]

plt.plot(x, y, marker="o")
plt.title("サンプルグラフ")
plt.xlabel("時間(秒)")  # ← ここがX軸ラベル
plt.ylabel("値")

plt.show()

Sources