Commit 6fa459ad authored by Mohcine Chraibi's avatar Mohcine Chraibi

polygon plot scripts consider new format

Format is now a string:

"id | polygon"
parent 74d8e5b1
Pipeline #9307 canceled with stages
......@@ -181,7 +181,10 @@ def main():
# TODO use os.path.join
polys = open("%s/polygon%s.dat"%(filepath,namefile)).readlines()
for poly in polys:
exec("p = %s"%poly)
poly = poly.split("|")
poly_index = poly[0].strip()
Poly = poly[1].strip()
exec("p = %s"%Poly)
pp = locals()['p']
polygons.append(pp)
xx=1.0/pol.Polygon(pp).area()
......@@ -201,6 +204,11 @@ def main():
sm.set_clim(vmin=0,vmax=5)
for j, poly in enumerate(polys):
ax1.add_patch(pgon(polygons[j],facecolor=sm.to_rgba(density_orig[j]), edgecolor='white',linewidth=2))
ax1.text(polygons[j].center()[0], polygons[j].center()[1], poly_index,
horizontalalignment='center',
verticalalignment='center',
fontsize=20, color='red',
transform=ax1.transAxes)
if(trajType=="xml"):
fps, N, Trajdata = parse_xml_traj_file(trajFile)
......
......@@ -61,7 +61,10 @@ if __name__ == '__main__':
sm.set_clim(vmin=0,vmax=1.5)
index=0
for poly in polys:
exec("p = %s"%poly)
poly = poly.split("|")
poly_index = poly[0].strip()
Poly = poly[1].strip()
exec("p = %s"%Poly)
xx = velocity[index]
index += 1
ax1.add_patch(pgon(p,facecolor=sm.to_rgba(xx), edgecolor='white',linewidth=2))
......@@ -84,7 +87,3 @@ if __name__ == '__main__':
cb.set_label('Velocity [$m/s$]')
plt.savefig("%s/v_%s.png"%(filepath,namefile))
plt.close()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment