未分類

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

python で文字列の長さを表示する方法

len を使う。 例 length = len(‘文字列あいうえお’) print(str(length)) 結果 8

no image

X(twitter) 時期を指定して検索する方法

X/Twitter の検索窓に次のように打ち込むことで、条件を指定して、絞り込んだポストを表示することができる。 日付を指定する since:2022-02-22 until:2022-02-23 あ …

no image

c++ で文字列(string)の長さを取得する方法

length() で取得する。 例 #include <iostream> #include <string> using namespace std; int main () { str …

no image

tex で三角形の相似記号を入力する

\sim を使う。 例 $\triangle{ABC} \sim \triangle{DEF}$ 結果

no image

tex で比例記号を入力する

数学で、y と x が比例するとき「比例記号」を使って表す方法がある。tex で表すには次のようにする。 例 $$ y \propto x $$ 結果 あなたがしてくれなくても 1【電子書籍】[ ハル …