https://github.com/damianfral/plotdsl
An experiment to play with the free monad and build a DSL for plotting.
https://github.com/damianfral/plotdsl
chart free-monad haskell plot
Last synced: 2 months ago
JSON representation
An experiment to play with the free monad and build a DSL for plotting.
- Host: GitHub
- URL: https://github.com/damianfral/plotdsl
- Owner: damianfral
- License: mit
- Created: 2014-10-11T15:09:01.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2025-02-01T18:27:16.000Z (4 months ago)
- Last Synced: 2025-02-01T19:26:17.277Z (4 months ago)
- Topics: chart, free-monad, haskell, plot
- Language: Haskell
- Homepage:
- Size: 42 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
::
l1 = do
name "new data"
color Red
smooth Sbezier
style Points
values [(0,2),(1,5),(2,4),(3,4),(4,3),(5,1)]l2 = do
name "old data"
color Blue
style Linespoints
values $ zip [0..] $ [3,2,7,3,5,2]plot1 = do
title "Free monad test"
scale $ Logscale Y 2.0
plot l1
plot l2
plot $ do
name "other data"
style Lines
smooth Csplines
color Green
values $ zip [0..] [1,2,5,3,9,1]wxtplot plot1
.. image:: ./img/ex1.png
::
ghci> let vs = zip [0..] [1,2,3,4,3,2,1,0]
ghci> dumbplot $ plot (name "example data" >> smooth Bezier >> values vs)4 ++--------+---------+---------+--------+---------+---------+--------++
+ + + + + example data ****** +
3.5 ++ ++
| |
| |
3 ++ *************** ++
| ***** **** |
2.5 ++ *** **** ++
| *** *** |
2 ++ *** ** ++
| *** *** |
| *** ** |
1.5 ++ *** ** ++
| ** ** |
1 ** ** ++
| ** |
| ** |
0.5 ++ *** ++
+ + + + + + + ***+
0 ++--------+---------+---------+--------+---------+---------+--------**
0 1 2 3 4 5 6 7