I have a list of points with absolute x and y coordinates:
points :: [(1,1), (2,2), (3,3), (-105, -42.42)]
And a list of edges as tuple of points:
edges :: [((1,1), (2,2)), ((1,1),(-105, -42.42)), ((3,3), (-105, -42.42))]
I now want to draw this using the diagrams
package, using circles for the nodes and lines for the edges. I have found the type Located
which should provide this functionality. On the other hand there is the atPoints
function, however they don't seem to achieve the same thing (atPoints
only moves the local origin).
What would be the idomatic way to achieve this? How do I use the Located
type?
You can use
moveTo
to, well, move some object to an absolute-specified position. And to draw edges between absolutely-defined vertices, you can usefromVertices
. Note that both don't accept tuples as arguments but points – but it's easy enough to convert to these.To combine these elements to a single diagram, you can just use the monoid instance, i.e.
mconcat
the list.