X-Git-Url: http://git.droids-corp.org/?p=aversive.git;a=blobdiff_plain;f=projects%2Fmicrob2010%2Ftests%2Foa%2Fgraph.py;h=49d3649f1487667223028cac42a5a86734ae913a;hp=d5946f1c52b9d4def328d661c7cac06fe9e7d896;hb=fa8546ea39c7442ad3bf5a822a72a2b50a41045d;hpb=9b20b69a87c9d442cf4610351dc40b28b7f36e9c diff --git a/projects/microb2010/tests/oa/graph.py b/projects/microb2010/tests/oa/graph.py index d5946f1..49d3649 100644 --- a/projects/microb2010/tests/oa/graph.py +++ b/projects/microb2010/tests/oa/graph.py @@ -170,7 +170,7 @@ def build_area(ax): # area x,y = build_poly([(0,0), (3000,0), (3000,2100), (0,2100)]) ax.plot(x, y, 'g-') - + x,y = build_poly([(0,0), (0,500), (500,500), (500,0)]) ax.plot(x, y, 'y-') @@ -179,16 +179,43 @@ def build_area(ax): x,y = build_poly([(740,0), (740,500), (2260,500), (2260,0)]) ax.plot(x, y, 'g--') - + + x,y = build_path([(375,0), (375,2050)]) + ax.plot(x, y, 'r-') + + x,y = build_path([(150,1972), (2850,472)]) + ax.plot(x, y, 'r-') + + x,y = build_path([(0,1722), (3000,1722)]) + ax.plot(x, y, 'r-') + + x,y = build_path([(150,972), (1950,1972)]) + ax.plot(x, y, 'r-') + + acoef = (2850-150)/5. + bcoef = (472-1972)/5. + x,y = build_path([(600,1972), (600+bcoef, 1972-acoef)]) + ax.plot(x, y, 'r-') + + p = PatchCollection([Circle((2400,972), 225)], + cmap=matplotlib.cm.jet, + alpha=0.5, facecolor=(1.,0.,0.)) + ax.add_collection(p) + # limit #x,y = build_poly([(250,250), (2750,250), (2750,1850), (250,1850)]) #ax.plot(x, y, 'g--') - + + xtick = [i * STEP_CORN_X + OFFSET_CORN_X for i in range(WAYPOINTS_NBX)] + ax.set_xticks(xtick) + ytick = [(i-1) * STEP_CORN_Y/2 + OFFSET_CORN_Y for i in range(WAYPOINTS_NBY*2)] + ax.set_yticks(ytick) + init_corn_table(random.randint(0,8), random.randint(0,3)) waypoints = init_waypoints() mark_all_neigh(5,6) - + wcorn = [] bcorn = [] points = [] @@ -246,13 +273,15 @@ def build_area(ax): def graph(filename): fig = plt.figure() - ax = fig.add_subplot(111) + ax = fig.add_subplot(111, aspect='equal') build_area(ax) - ax.grid() + ax.grid(color = (0.3, 0.3, 0.3)) ax.set_xlim(-100, 3100) ax.set_ylim(-100, 2200) + #ax.set_xlim(0, 825) + #ax.set_ylim(1472, 1972) #ax.set_title('spline paths') #plt.show() fig.savefig(filename)