1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

matplotlib ~ グラフに点を書く

Last updated at Posted at 2021-03-03

matplotlibはpythonで行った計算を描画する際に便利です.
今回はシンプルに任意の点をグラフに描画します.

グラフの作成

グラフの作成
import matplotlib.pyplot as plt

fig = plt.figure()
ax1 = fig.add_subplot(111)

plt.xlim(-300,300)
plt.ylim(-200,200)

plt.xlabel('x')
plt.ylabel('y')

plt.grid()

plt.show()

任意の範囲のグラフが描画できました.
Figure_1.png

グラフ上に点を描画するときはplt.plot(100,50,marker='.')のように追加

グラフに点を追加
import matplotlib.pyplot as plt

fig = plt.figure()
ax1 = fig.add_subplot(111)

plt.xlim(-300,300)
plt.ylim(-200,200)

plt.xlabel('x')
plt.ylabel('y')

plt.grid()

plt.plot(100,50,marker='.') ##追加

plt.show()

以下のように点が描画できました.
Figure_2.png

1
2
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
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?