Preprocess your data as follows, using awk or your favourite language
For each rectangle:
- print x+y coordinates of its lower left corner
- print x+y coordinates of its upper left corner
- print x+y coordinates of its upper right corner
- print x+y coordinates of its lower right corner
- print x+y coordinates of its lower left corner
- print a blank line (to suppress the connection between rectangles)
Plot this file with lines
.
Write the edges into a second file
For each edge:
- print x+y coordinates of midpoint of first rectangle
- print x+y coordinates of midpoint of second rectangle
- print blank line
Plot this file with lines
.
Write the labels into a third file (x, y, label)
Plot them with labels
.