[Haskell-cafe] using withAnnotations from Graphics.Rendering.Plot.Figure

Albert Cardona sapristi at gmail.com
Thu May 22 17:26:29 UTC 2014

Hi all,

given two Vector and a list of strings, I generate a plot of one vector as
a function of the other [1]. At each x,y point, I am trying to place the
corresponding string. For the purpose, I zip3 all three sequences, define
an annotation function, and invoke it with mapM_ in the context of
withAnnotations [2]:

withPlot (1, 1) $ do
  let annotation (x, y, label) = text (x + 2, y) (setText label)
    in withAnnotations $ do mapM_ annotation $ zip3 (toList vx) (toList vy)

The code above compiles and runs, the plot shows, but no text annotations
appear at all.

I understand that I am not using the Annote monad correctly: the mapM_
drops every returned value, so the state is not altered.

What is the correct way to invoke withAnnotations over a list of (x, y,
String) ?

Needless to say, I am a beginner in Haskell. Apologies if the above is too

Thanks very much in advance.




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140522/24fc6a82/attachment.html>

More information about the Haskell-Cafe mailing list