未分類

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

tex で行の色を1行ごとに交互につける

色を1行ごとに交互につけるには、\xcolor パッケージを使った上で、\rowcolors コマンドを使って色を指定する。 例 \usepackage[table]{xcolor} \begin{d …

no image

c言語 ターミナル上で出力した文字列の表示を初期化する

エスケープシーケンス \033[2J と\033[u を使う。 例 #include <unistd.h> #include <stdio.h> int main() { in …

no image

c++ で文字列(string)の foreach 操作を行う方法

string の各文字に対して操作を行うには、「iterator」(イテレータ)を使ってループを作る方法がある。iterator の変数名は、it としておくと分かりやすい。 例 #include&l …

no image

tex でダガー記号を入力する方法

ダガー記号には、$\dagger$ を使う。上付きにしたい場合には、$^$ と組み合わせる。 例 $A^{\dagger}$ 結果

no image

python3 で、文字列が別の文字列に含まれているかどうか判定する方法

in 演算子を使うことが最も簡単。 例 str1 = “こんにちは” str2 = “んにち” if str2 in str1:  print(“含まれています”) else:  print(“含まれ …