1
- # Matplotlib
1
+ ![ matplotlib contour plot] ( https://github.com/abarbu/matplotlib-haskell/raw/master/imgs/contour.png )
2
+
3
+ # Matplotlib for Haskell
2
4
3
5
[ ![ Build Status] ( https://img.shields.io/circleci/project/github/abarbu/matplotlib-haskell.svg )] ( https://circleci.com/gh/abarbu/matplotlib-haskell )
4
6
[ ![ Hackage] ( https://img.shields.io/hackage/v/matplotlib.svg )] ( https://hackage.haskell.org/package/matplotlib )
5
7
6
8
Haskell bindings to Python's Matplotlib. It's high time that Haskell had a
7
- fully-fledged plotting library!
9
+ fully-fledged plotting library! Examples below.
8
10
9
- ![ matplotlib contour plot] ( https://github.com/abarbu/matplotlib-haskell/raw/master/imgs/contour.png )
11
+ [ Documentation is available on Hackage] ( https://hackage.haskell.org/package/matplotlib ) .
12
+
13
+ In GHCi:
14
+
15
+ ``` haskell
16
+ : set - XExtendedDefaultRules
17
+ import Graphics.Matplotlib
18
+ onscreen $ contourF (\ a b -> sin (a* pi / 180.0 ) + cos (b* pi / 180.0 )) (- 100 ) 100 (- 200 ) 200 10
19
+ ```
10
20
11
- [ Documentation is available on Hackage] ( https://hackage.haskell.org/package/matplotlib ) . For
12
- more examples see the tests.
21
+ Or in a standalone file
13
22
14
23
``` haskell
15
24
{-# LANGUAGE ExtendedDefaultRules #-}
16
25
17
26
import Graphics.Matplotlib
18
27
19
- degreesRadians a = a * pi / 180.0
20
-
21
- main :: IO ()
22
- main = do
23
- Right _ <- onscreen $ contourF (\ a b -> sin (degreesRadians a) + cos (degreesRadians b)) (- 100 ) 100 (- 200 ) 200 10
24
- return ()
28
+ main = onscreen $ contourF (\ a b -> sin (a* pi / 180.0 ) + cos (degreesRadians b)) (- 100 ) 100 (- 200 ) 200 10
25
29
```
26
30
27
31
We need ` -XExtendedDefaultRules ` to avoid having to manually having to specify certain types.
@@ -32,14 +36,27 @@ You will need several python libraries to run this code which can be installed
32
36
on Ubuntu machines with the following command:
33
37
34
38
``` bash
35
- sudo apt-get install -y python3-pip python3-matplotlib python3-numpy python-mpltoolkits.basemap
39
+ sudo apt-get install -y python3 python3-pip python3-matplotlib python3-numpy python3-tk python-mpltoolkits.basemap python3-scipy dvipng
40
+ ```
41
+
42
+ If you're using conda
43
+
44
+ ``` bash
45
+ conda install matplotlib scipy tk
36
46
```
37
47
38
- If you have instructions for other machines or OSes let me know. We require
39
- ` /usr/bin/python3 ` to be available; the path isn't configurable right now.
48
+ If you have instructions for other machines or OSes let me know. We require the
49
+ ` python3 ` binary to be available somewhere in the PATH. We run with
50
+ ` env python3 ` .
40
51
41
52
Once you have the prerequisites you can install using the standard incantation
42
53
54
+ ``` bash
55
+ stack install matplotlib
56
+ ```
57
+
58
+ or
59
+
43
60
``` bash
44
61
cabal install matplotlib
45
62
```
@@ -89,76 +106,76 @@ different.
89
106
[ ![ pie] [ img_pie ]] [ url_pie ]
90
107
91
108
[ img_violinplot ] : https://i.imgur.com/iBOfnuL.png " violinplot "
92
- [ url_violinplot ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L301
109
+ [ url_violinplot ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L299
93
110
[ img_contour ] : https://i.imgur.com/KoAIf9Z.png " contour "
94
- [ url_contour ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L225
111
+ [ url_contour ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L223
95
112
[ img_tex ] : https://i.imgur.com/bR8r579.png " tex "
96
- [ url_tex ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L260
113
+ [ url_tex ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L258
97
114
[ img_scatterhist ] : https://i.imgur.com/9ZIVotE.png " scatterhist "
98
- [ url_scatterhist ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L308
115
+ [ url_scatterhist ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L306
99
116
[ img_line-options ] : https://i.imgur.com/Fahp7QA.png " line-options "
100
- [ url_line-options ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L250
117
+ [ url_line-options ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L248
101
118
[ img_griddata ] : https://i.imgur.com/SH83pJK.png " griddata "
102
- [ url_griddata ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L605
119
+ [ url_griddata ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L603
103
120
[ img_pcolorlog ] : https://i.imgur.com/ZLUoUqy.png " pcolorlog "
104
- [ url_pcolorlog ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L498
121
+ [ url_pcolorlog ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L496
105
122
[ img_cumulative ] : https://i.imgur.com/u5I8NYF.png " cumulative "
106
- [ url_cumulative ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L218
123
+ [ url_cumulative ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L216
107
124
[ img_annotation ] : https://i.imgur.com/9tdHiaT.png " annotation "
108
- [ url_annotation ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L542
109
- [ img_hist2DLog ] : https://i.imgur.com/2fL8oEX.png " hist2DLog "
110
- [ url_hist2DLog ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L278
125
+ [ url_annotation ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L540
111
126
[ img_density ] : https://i.imgur.com/KS2OhbH.png " density "
112
- [ url_density ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L242
127
+ [ url_density ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L240
113
128
[ img_line-function ] : https://i.imgur.com/zkpfQqW.png " line-function "
114
- [ url_line-function ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L244
129
+ [ url_line-function ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L242
115
130
[ img_boxplot ] : https://i.imgur.com/KigvYSc.png " boxplot "
116
- [ url_boxplot ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L295
131
+ [ url_boxplot ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L293
117
132
[ img_show-matrix ] : https://i.imgur.com/ajY0A9l.png " show-matrix "
118
- [ url_show-matrix ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L270
119
- [ img_hinton ] : https://i.imgur.com/m9a4IwL .png " hinton "
120
- [ url_hinton ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L383
133
+ [ url_show-matrix ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L268
134
+ [ img_histMulti ] : https://i.imgur.com/FxEI3EI .png " histMulti "
135
+ [ url_histMulti ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L335
121
136
[ img_streamplot ] : https://i.imgur.com/IfHLmkC.png " streamplot "
122
- [ url_streamplot ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L585
137
+ [ url_streamplot ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L583
123
138
[ img_pie ] : https://i.imgur.com/ljgWXf6.png " pie "
124
- [ url_pie ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L519
139
+ [ url_pie ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L517
125
140
[ img_corr ] : https://i.imgur.com/GnBpDJL.png " corr "
126
- [ url_corr ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L255
141
+ [ url_corr ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L253
127
142
[ img_projections ] : https://i.imgur.com/IlK7Oy3.png " projections "
128
- [ url_projections ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L248
129
- [ img_stacked ] : https://i.imgur.com/rWIyizX.png " stacked "
130
- [ url_stacked ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L526
143
+ [ url_projections ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L246
144
+ [ img_scatter ] : https://i.imgur.com/dceKS4I.png " scatter "
145
+ [ url_scatter ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L218
146
+ [ img_legend ] : https://i.imgur.com/X46KiUJ.png " legend "
147
+ [ url_legend ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L271
131
148
[ img_density-bandwidth ] : https://i.imgur.com/Qgjvrox.png " density-bandwidth "
132
- [ url_density-bandwidth ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L239
149
+ [ url_density-bandwidth ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L237
133
150
[ img_bivariateNormal ] : https://i.imgur.com/fTSfEzo.png " bivariateNormal "
134
- [ url_bivariateNormal ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L468
135
- [ img_histMulti ] : https://i.imgur.com/FxEI3EI .png " histMulti "
136
- [ url_histMulti ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L337
151
+ [ url_bivariateNormal ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L466
152
+ [ img_hinton ] : https://i.imgur.com/m9a4IwL .png " hinton "
153
+ [ url_hinton ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L381
137
154
[ img_quadratic ] : https://i.imgur.com/E4AafPD.png " quadratic "
138
- [ url_quadratic ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L246
155
+ [ url_quadratic ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L244
139
156
[ img_histogram ] : https://i.imgur.com/X37Rmy4.png " histogram "
140
- [ url_histogram ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L215
157
+ [ url_histogram ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L213
141
158
[ img_polar ] : https://i.imgur.com/4DAOrF1.png " polar "
142
- [ url_polar ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L453
159
+ [ url_polar ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L451
143
160
[ img_quiver ] : https://i.imgur.com/TcayDLc.png " quiver "
144
- [ url_quiver ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L426
161
+ [ url_quiver ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L424
145
162
[ img_quiver-fancy ] : https://i.imgur.com/NsOFHhx.png " quiver-fancy "
146
- [ url_quiver-fancy ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L437
163
+ [ url_quiver-fancy ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L435
164
+ [ img_stacked ] : https://i.imgur.com/rWIyizX.png " stacked "
165
+ [ url_stacked ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L524
147
166
[ img_spines ] : https://i.imgur.com/BryQOY9.png " spines "
148
- [ url_spines ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L355
149
- [ img_errorbar ] : https://i.imgur.com/gi0zEiz.png " errorbar "
150
- [ url_errorbar ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L290
151
- [ img_legend ] : https://i.imgur.com/X46KiUJ.png " legend "
152
- [ url_legend ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L273
167
+ [ url_spines ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L353
168
+ [ img_hist2DLog ] : https://i.imgur.com/2fL8oEX.png " hist2DLog "
169
+ [ url_hist2DLog ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L276
153
170
[ img_integral ] : https://i.imgur.com/PkepIKR.png " integral "
154
- [ url_integral ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L399
155
- [ img_scatter ] : https://i.imgur.com/dceKS4I .png " scatter "
156
- [ url_scatter ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L220
171
+ [ url_integral ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L397
172
+ [ img_errorbar ] : https://i.imgur.com/gi0zEiz .png " errorbar "
173
+ [ url_errorbar ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L288
157
174
[ img_labelled-histogram ] : https://i.imgur.com/lCVEpge.png " labelled-histogram "
158
- [ url_labelled-histogram ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L227
175
+ [ url_labelled-histogram ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L225
159
176
[ img_eventplot ] : https://i.imgur.com/UMT1yku.png " eventplot "
160
- [ url_eventplot ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L283
177
+ [ url_eventplot ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L281
161
178
[ img_hists ] : https://i.imgur.com/KurE2Sr.png " hists "
162
- [ url_hists ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L374
179
+ [ url_hists ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L372
163
180
[ img_images ] : https://i.imgur.com/R1fhDXC.png " images "
164
- [ url_images ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L485
181
+ [ url_images ] : https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L483
0 commit comments