haskellhaskell-diagrams

How can I draw text on a haskell chart graphics?


I would like to draw some label besides points on a XY chart drawn using Chart with diagrams backend in Haskell. Eg. I have data like:

data = [("foo", 1,2), ("bar", 1, 3), ... ]

and would like to draw labels foo and bar at or near coordinates (1,2) and (1,3) respectively.


Solution

  • You can do this using PlotAnnotation. Something like:

    toPlot $ def & plot_annotation_values .~ [(1, 2, "foo"), (1, 3, "bar"), ... ]