Skip to content

Instantly share code, notes, and snippets.

@mattn

mattn/gf.py Secret

Created July 3, 2017 03:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattn/de64e4c8c2ba20e3f5cd939426e9079a to your computer and use it in GitHub Desktop.
Save mattn/de64e4c8c2ba20e3f5cd939426e9079a to your computer and use it in GitHub Desktop.
# -*- encoding:utf-8 -*-
from numpy import genfromtxt
from matplotlib import pyplot
import sys
import csv
d = genfromtxt("example.csv", delimiter=",") # データ読み込み 計画線量
# tail -f aiueo.csv | python this program.py
fig = pyplot.figure(figsize=(16,9))
# 全体を2x2に分割し、1枚目(左半分)に描写
ax = fig.add_subplot(121)
ax.set_xlabel("X-axis")
ax.set_ylabel("Y-axis")
#ax.set_zlabel("Z-axis")
ax.set_xlim(-30, 30)
ax.set_ylim(-40, 20)
#ax.set_zlim(100, 200)
ax.plot(d[:,0], d[:,1], d[:,2], "o", color="g", ms=16, mew=0.5)
ax.grid(True)
# 全体を2x2に分割し、2枚目(右上)に描写
ax = fig.add_subplot(222)
ax.set_xlabel('X-axis')
ax.set_ylabel('Y-axis')
ax.set_xlim(-30, 30)
ax.set_ylim(-40, 20)
ax.plot(d[:,0], d[:,1], "o", color="g", ms=24, mew=0.5)
ax.grid(True)
# 全体を2x2に分割し、3枚目(右下) に描写
ax = fig.add_subplot(224)
ax.set_xlabel('Z-axis')
ax.set_ylabel('Y-axis')
ax.set_xlim(100, 200)
ax.set_ylim(-40,20)
ax.plot(d[:,2], d[:,1], "o", color="g", ms=24, mew=0.5)
ax.grid(True)
fig.show()
rows = csv.reader(sys.stdin)
next(rows) # ヘッダを捨てる
for row in rows:
ax.plot(d[:,0], d[:,1], "o", color="g", ms=24, mew=0.5)
pyplot.pause(-1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment