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 で、線の種類を変更する方法

「linestyle = 」として、線の種類を指定することができる設定の詳細は、次のリンクを参照。 https://matplotlib.org/stable/gallery/lines_bars_a …

no image

python3 で整数の割り算、商と余りを求める方法

floor divisionを使う。 例 a = 15 // 7 b = 15 % 7 print(a) print(b) 結果 2 1

no image

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

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

no image

python3 の辞書で、キー一覧を取り出して表示する方法

keys()メソッドでは、キー一覧を取得できる。values() では、値を取得できる。items() では、キーと値をタプルとして取得できる。 リストに変換すると、print() でコンソールに表示 …

no image

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

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