未分類

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 で三角形の相似記号を入力する

\sim を使う。 例 $\triangle{ABC} \sim \triangle{DEF}$ 結果

no image

tex で文字の上の点を入力する方法

テキストモードでは \. 数式モードでは \dot{} を使う。 例 \.{a}$\dot{x}$ 結果

no image

tex で文字列を変数として設定する方法

\newcommand を使って指定する。入力の数は自由に指定できる。 例 \newcommand{\variable}[2]{Hello #1. Good #2.} \variable{Taro}{ …

no image

c++ で文字列が他の文字列を含むか判定する方法

文字列を含むかどうか判定するには、string の find を使う。見つからなかった場合は、std::string::npos を返す。 例 #include <iostream> #i …

no image

h バー(プランク定数)の書き方

量子科学では、「プランク定数」を h で表すが、h を 2π で割った量を エイチバーで表すことがある。 tex での書き方 $\hbar$ 結果 リベンジH 4【電子書籍】[ 仙道ますみ ]価格:6 …