未分類

matplotlib で x, y軸・タイトルのフォントサイズを調整する

投稿日:

ラベルの fontsize で指定する。

import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(0, 2, 100)
plt.plot(x, x*x, label='linear')

plt.xlabel('x axis', fontsize=20)
plt.ylabel('y axis', fontsize=20)
plt.title("large title", fontsize=30)
plt.show()

結果

-未分類

執筆者:


comment

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

関連記事

no image

python3 で、ある文字列で始まるかどうか判定する方法

文章が、ある文字列で始まるかどうかを判定するには startswith を使う。 例 str = “こんにちは。” print(str.startswith(‘こん’)) print(str.star …

no image

C言語で文字をアルファベット順にずらす

C言語で文字をずらすには、char 型の変数に1を加えればよい。 例 #include <stdio.h> int main(void) { char c; c = ‘a’; c++; p …

no image

tex で期待値記号を入力する方法

\mathbf を使う。 例 $\mathbf{E}(\xi)$ 結果

no image

matplotlib で縦横の罫線を出力する

罫線を出力するには、pyplot.grid を使う。 例 import numpy as np import matplotlib.pyplot as plt x = np.linspace(0, 2 …

no image

tex でかけ算の記号 x (✕)を表示する

かけ算記号を表示するには、$\times$ を使う。 例 $2 \times 3$ 結果