plt.xlabel と plt.ylabel を使う。
例
import numpy as np import matplotlib.pyplot as plt x = np.linspace(0, 2, 100) plt.plot(x, x, label='linear') plt.xlabel('x axis') plt.ylabel('y axis') plt.title("title") plt.show()
結果

雑記
投稿日:
plt.xlabel と plt.ylabel を使う。
import numpy as np import matplotlib.pyplot as plt x = np.linspace(0, 2, 100) plt.plot(x, x, label='linear') plt.xlabel('x axis') plt.ylabel('y axis') plt.title("title") plt.show()
執筆者:seyanen
関連記事
行列を水平方向に並べるとき、間隔を開けたいことがある。\hspace コマンドを使うことで、水平方向の間隔を指定することができる。(行列表示には amsmath パッケージを使う。) 例 \usepa …
python3 で、指定した文字が最後に現れる場所を取得する
rfind を使うと、指定した文字が最後に現れる場所(インデックス)を取得することができる。 例 str1 = “12345abab” result = str1.rfind(“ab”) print( …
data.txt からの入力から、「4 5 6」というデータがある行を削除して、output.txt に出力する。(データの各行の最後に \n があることに注意。) 例 f = open(‘data. …
python3 で辞書(dict) の for ループでキーと値を取得する
キーと値を取得するには次のようにする。キーは dict のループ、値は dict の values() のループで取得できる。 例 mydictionary = {‘color’: ‘白’, ‘ani …
2023/01/18
matplotlib のグラフ作成と gnuplot との対応 比較
2022/10/14
pythonで配列(リスト)の、ある要素がわかっているときにその次の要素を取得する方法。