#画三维线 #coding:utf-8 from mpl_toolkits.mplot3d import axes3d import matplotlib.pyplot as plt x = [] y = [] z = [] f = open("data\record.txt") line = f.readline() while line: c,d,e = line.split() x.append(c) y.append(d) z.append(e) line = f.readline() f.close() #string型转int型 x = [ int( x ) for x in x if x ] y = [ int( y ) for y in y if y ] z = [ int( z ) for z in z if z ] #print x fig=plt.figure() ax = fig.gca(projection = '3d') ax.plot(x,y,z) ax.set_xlabel('x') ax.set_ylabel('y') ax.set_zlabel('z') plt.show()
|
近期评论