为什么这没有附加到ci
and mag
?我的数据显然有这个范围内的点。
import numpy as np
import csv
import matplotlib.pyplot as plt
import random
from pylab import *
ci = []
mag =[]
cntr = 0
#fig = plt.scatter()
#ax1 = fig.add_subplot(111)
#ax2 = twiny()
import csv
with open('test2.csv', 'r') as f:
reader = csv.reader(f)
for row in reader:
try:
if (float(row[0]) < 2.5) and (float(row[1]<15.0)) and (float(row[1]>-10.0)):
ci.append(float(row[0]))
mag.append(float(row[1]))
cntr+=1
except Exception, e:
pass
print ci[1], mag[1]
N = 50
x = ci
y = mag
area = .001
plt.scatter(x, y, s=area, alpha=0.25)
#plt.plot(x, y, ', ')
plt.xlabel('Color Index')
plt.ylabel('Magnitude')
plt.title('H-R Diagram')
plt.gca().invert_yaxis()
plt.show()