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

matplotlib でエラーバーを設定する方法

pyplot.errorbar を使って設定する。 オプションの詳細は https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.erro …

no image

matplotlib で、縦横の罫線を引く方法

破線をカスタマイズする方法 以下では、dashes = [5,2,2,2] で、線5・空白2・線2・空白2の破線を指定している。 詳しくは次を参照。 https://matplotlib.org/st …

no image

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

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

no image

python3 で集合(set)の和集合を作る

集合にモノを付け足して和集合を作るには、|= 演算子を使う。(python では、集合(set)を波かっこで囲んで表す。) 例 a = {‘東京’} b = {‘大阪’,’千葉’} c = a | b …

no image

matplotlib で、ヒストグラムを作成する方法

ヒストグラムを描くには、data_hist を使う。 ヒストグラムの縦棒の数は bins で指定する。 例 from matplotlib import pyplot as plt data_hist …