top of page

Pythonで座標を表示

  • hiro2studio
  • 2021年2月6日
  • 読了時間: 1分

matplotlibのscatterを利用して座標系の位置を表示

#!/usr/bin/env python3
# -*- coding: utf-8 -*-


import numpy as np
import matplotlib.pyplot as pt

#-------------------------------------------------
## main ###
#-------------------------------------------------
if __name__=='__main__':

    # int型の0で初期化
    fig1 = np.zeros((10,10,2),dtype=np.int)
    fig2 = np.zeros((10,10,2),dtype=np.int)

    fig = pt.figure()
    asp = fig.add_subplot(1, 1, 1)

    for i in range(0,10):
        for j in range(0,10):
            fig1[i][j][0] = j*10
            fig1[i][j][1] = i*10
            fig2[i][j][0] = j*11
            fig2[i][j][1] = i*11
            asp.scatter(fig1[i][j][0], fig1[i][j][1], c='red')
            asp.scatter(fig2[i][j][0], fig2[i][j][1], c='c')

    print(fig1)
    print(fig2)

    asp.grid(True)

    pt.show()


 
 
 

最新記事

すべて表示
PythonでYAHOO検索もスクレイピング

前回Google検索結果のTOP100取ったのでYAHOOも追加。 YAHOOは10件ずつしか取れないので注意! #!/usr/bin/env python3 # -*- coding: utf-8 -*- # 指定のURLをブラウザで開く #...

 
 
 

Comments


記事: Blog2_Post

©2021 by 日々Python。Wix.com で作成されました。

bottom of page