Haskell plotting library similar to MATLAB

后端 未结 5 1289
天涯浪人
天涯浪人 2021-02-02 09:00

Is there a Haskell library for drawing plots similar to MATLAB, scilab or matplotlib? They all have very simple interfaces, which work like a state machine:

plot         


        
5条回答
  •  花落未央
    2021-02-02 09:46

    From a glance at matplotlib, I don't think the Haskell ecosystem has anything as feature-rich. However, I've been happy with the results produced by the Chart library. There are also bindings to graphviz (that links one of several) and Ubigraph.

    Edit: Responding to the request for plotting (x,y) coordinates:

    I'm not entirely clear what you want. If you have a function f :: x -> y then just use the plotWindow (or PNG, etc) function:

    import Graphics.Rendering.Chart.Simple
    main = plotWindow [0,0.1..5::Double] sin
    

    If you have a bunch of points, [(x,y)], then the same code with a lookup into the list, instead of a continuous function like sin, should work fine. See the linked page for many many examples.

提交回复
热议问题