How do I read the data from the file and plot the rectangle? The given text file has the following format up to 50 rows: x1 y1 x2 y2 x3 y3 x4 y4
where (x1,y1), (x2,y2), (x3,y3) and (x4,y4) are the four vertices of the rectangle. The rectangles have random orientation. How do I plot the series of rectangles in gnuplot?
If someone can tell me how to read from a file while using set object polygon, that may also be helpful what I want: set object polygon from to to to .
Or, is there any other simpler code in gnuplot? Alternatively is there a python solution?
My Gnuplot
solution (not just for rectangles, but any kind of polygons):
plot 'rectal.dat' u 1:2:($3-$1):($4-$2) with vectors nohead lc 1 title 'Rectangle', \
'' u 3:4:($5-$3):($6-$4) with vectors nohead lc 1 notitle, \
'' u 5:6:($7-$5):($8-$6) with vectors nohead lc 1 notitle, \
'' u 7:8:($1-$7):($2-$8) with vectors nohead lc 1 notitle
0 0 0 1 1 1 1 0
0 0 0 2 2 2 2 0
-0.5 -0.5 -1 1 -0.5 2 0 1