0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Python】散布図のscatterメソッド

Posted at

散布図のscatterメソッドは次のように記述します。

fig, ax = plt.subplots()

乱数のシード値を固定

np.random.seed(0)

NumPyのrandom.rand関数で0〜1の範囲で10個の乱数を作成

x1 = np.random.rand(10)
y1 = np.random.rand(10)
x2 = np.random.rand(10)
y2 = np.random.rand(10)

scatterメソッドの第1引数でx軸の値、第2引数でy軸の値を指定

ax.scatter(x1, y1, label='データ1')
ax.scatter(x2, y2, label='データ2')

凡例を表示

ax.legend()

image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?