matplotlib python3

matplotlib で、グラフの点の見た目を変更する方法

投稿日:

「marker」で指定すればよい。

次のページを参考に、plotの「marker」を変更する。

https://matplotlib.org/stable/api/markers_api.html

from matplotlib import pyplot as plt

data_x = [25,26,27]
data_y = [39,41,50]
data_y2 = [40,20,17]

plt.plot(data_x,data_y,c='green',marker='o')
plt.plot(data_x,data_y2,c='blue',marker='v')

plt.show()

結果

-matplotlib, python3
-,

執筆者:


comment

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

関連記事

no image

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

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

no image

matplotlib で、複数のグラフを簡単にプロットする方法

変数を並べて書くと、次のように自動的に順番を理解してグラフを表示してくれる。 例 import numpy as np from matplotlib import pyplot as plt fro …

no image

python3 で、すべて小文字かどうかを判定する方法

islower() 関数を使う。 例 print(‘abcde’.islower()) print(‘abcDe’.islower()) 結果 True False

no image

pythonで配列(リスト)の、ある要素がわかっているときにその次の要素を取得する方法。

next() を使う。 例 my_arr = [‘春’,’夏’,’秋’,’冬’] my_iter = iter(my_arr) print(next(my_iter,’なし’)) print(next …

no image

python でリストに、コロン演算子2つ(::)を使う

リストのコロンで指定できるパラメータには、「start, end, step」という意味がある。 以下の例では、:: 5 とした場合には、5 をステップとして、次に進んでいく。 ::-5 とした場合に …