matplotlib python3

matplotlib で、グラフのタイトルに上付き文字を入力する方法

投稿日:

数学記号などで、グラフのタイトルに上付きの文字を入力したい場合がある。

その場合は次のように書いて設定できる。

import numpy as np
from matplotlib import pyplot as plt

x = [1,2,3,5]
y = [3,7,9,1]
size = 100

fig, ax = plt.subplots()
ax.set(title=r'data of $e^x \sin \theta$',ylabel=r'$e^x \sin \theta$',xlabel=r'$e^\Omega$')
ax.scatter(x,y,size,'blue')

plt.show()

結果

-matplotlib, python3
-,

執筆者:


comment

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

関連記事

no image

python の for ループで、データだけでなくインデックスも一緒に取得する

通常の for ループではなく、enumerate() を使うとインデックスが取得できる。 例 list1 = [’太郎’,’次郎’,’三郎’] for i, name in enumerat …

no image

matplotlib で複数のグラフを並べて表示する方法

plot.subplots() でグラフの縦方向と横方向の数を指定する。 例 import numpy as np from matplotlib import pyplot as plt x1 = …

no image

python3 でリストを結合する方法

2つのリストを結合して、「リストのリストを作りたい場合」と、「1つの長いリストを作りたい」場合がある。 それぞれ、次のようにする。 例 # リスト2つを用意 l_1 = [1,2,3] l_2 …

no image

python3 でコンソールからの入力をリストに格納する方法

入力を受け取るには、input() を使う。range(0,5) で、5個の文字列を順に受け取り、リストに入れてそれを表示する。 例 list1 = [] for i in range(0, …

no image

matplotlib でグラフ表示ウィンドウの画面上の位置を自由に設定する方法

matplotlib.use(‘TkAgg’) としておき、 get_current_fig_manager().window.wm_geometry(“+20+50”) として、(+20+50)のと …