The following are my code and the resulting data plot.
---------------------------------------------
Code:
from pylab import *
from numpy import *
data =[]
#generate random data sets
data.append( 1.2*random.randn(2,30) )
data.append( 2.0*random.randn(2,30) )
data.append( random.randn(2,30) )
#shift the data sets
x0 = data[0][0]; y0 = data[0][1]
x1 = data[1][0]+3.5; y1 = data[1][1]+2.5
x2 = data[2][0]-1.5; y2 = data[2][1]+4.5
f = open('randData','w')
for i in range(len(x0)):
print >> f, '%f %f %f %f %f %f'\
% (x0[i], y0[i], x1[i], y1[i], x2[i], y2[i])
f.close()
plot(x0, y0, 'ro', x1, y1, 'go', x2, y2, 'bo')
savefig('randData.png')
show()
No comments:
Post a Comment