0

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.

Chris Stryczynski
  • 30,145
  • 48
  • 175
  • 286
insitu
  • 4,488
  • 3
  • 25
  • 42

1 Answers1

2

You can do this using PlotAnnotation. Something like:

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

bergey
  • 3,041
  • 11
  • 17
  • Thanks. It works but I am still puzzled on how to configure font attributes... Will have to look a little bit more into it. Could you please tell me where you took that knowledge from? I was not able to find documents on the wiki site and the featured examples do not plot annotations (AFAICT). – insitu Jan 15 '14 at 18:08
  • I just went to Hackage and browsed the per-module docs there. – bergey Jan 15 '14 at 20:24
  • Thanks for your patience and answer. Will try to be less impatient and search more thoroughly next time... – insitu Jan 15 '14 at 21:47
  • No worries. It took me a long time to get used to Haskell's current state of documentation for (almost) every function, but few tutorials. – bergey Jan 16 '14 at 03:24
  • Well, it is just that Chart is large and I did not have much time. But having been programming Haskell for more than ten years, I am quite aware that documentation, examples and practical tutorials are not always valued... But this is overgeneralisation. – insitu Jan 16 '14 at 21:22