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

gnuplot で、グラフの形を正方形にする方法

set size square または、その省略形で set size sq というコマンドを使えば正方形の中にグラフを描くことができる。 例 set size square plot cos(x) …

no image

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

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

no image

python3 で、配列の配列をソートする

ラムダ式を使って、任意の要素についてソートすることができる。 例 arr = [[1,2,3],[2,1,2],[3,3,4],[4,4,1]] for i i …

no image

python3 でランダムな整数の配列を作る方法

random モジュールを使う。randint() の引数で、配列の最小値と最大値を指定できる。 例 import random random_arr = [random.randint(-2 …

no image

matplotlib で、y軸に二種類の軸を設定する方法

y軸に、2種類のグラフを異なるスケールでプロットする。 matplotlib axes の twinx() を使う。 https://matplotlib.org/stable/api/_as_gen …