未分類

matplotlib で x軸・y軸ラベルをつける

投稿日:

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()

結果

-未分類

執筆者:


comment

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

関連記事

no image

tex で href の色を変更する方法

例で、urlcolor=red と書けば、「link to google」の文字列は赤色(red)になる。 もし urlcolor=blue と書けば、リンクは青色になる。 例 \usepackage …

no image

tex で、割り算記号を入力する方法

physics パッケージを使って、\divisionsymbol で割り算記号が入力できる。 例 \usepackage{physics} \begin{document} $2 \division …

no image

tex で方程式を文書の中央揃えにする(eqnarray→ align)

amsmath パッケージを使ったうえで、align を使う。次の例では eqnarray の代わりに、align を使っている。 例 \usepackage {amsmath}  \begin{do …

no image

tex で文章を右寄せにする方法

テキストを \flushright で囲めば良い。 例 \begin{flushright} Lorem, ipsum dolor sit amet consectetur adipisicing e …

no image

python3 で文字列を区切り文字を指定してリストに変換する方法

split メソッドを使う。 例 str1 = ‘this, is, a, pen’ str2 = str1.split(‘,’) print(str2) 結果 [‘this’, ‘ is’, ‘ a …