Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gargantext-ihaskell
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
gargantext-ihaskell
Commits
1889f5cd
Commit
1889f5cd
authored
Jan 24, 2016
by
louis
Committed by
Andrew Gibiansky
Mar 26, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
created a display instance for the (haskell-)gnuplot package
parent
fd7da220
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
315 additions
and
0 deletions
+315
-0
Gnuplot.hs
...kell-display/ihaskell-gnuplot/IHaskell/Display/Gnuplot.hs
+186
-0
LICENSE
ihaskell-display/ihaskell-gnuplot/LICENSE
+20
-0
Setup.hs
ihaskell-display/ihaskell-gnuplot/Setup.hs
+2
-0
ihaskell-gnuplot.cabal
ihaskell-display/ihaskell-gnuplot/ihaskell-gnuplot.cabal
+70
-0
stack.yaml
ihaskell-display/ihaskell-gnuplot/stack.yaml
+33
-0
stack.yaml
stack.yaml
+4
-0
No files found.
ihaskell-display/ihaskell-gnuplot/IHaskell/Display/Gnuplot.hs
0 → 100644
View file @
1889f5cd
{- There are 3 types of plots to consider in haskell-gnuplot: Plot, Frame and Multiplot.
Plot types are the actual plots, whereas Frame types are plots with additional options
e.g. custom axes tics, graph title etc.. Multiplots are collections of 2D and/or 3D plots.
We have to create instances of IHaskellDisplay for all of these types.
Note: To stop gnuplot from printing the filepath ontop of the canvas, you have to set
the gnuplot option "key" to "noautotitle".
Code: Graphics.Gnuplot.Frame.cons (Graphics.Gnuplot.Frame.OptionSet.add
(Graphics.Gnuplot.Frame.Option.key "")
["noautotitle"] $ ...)
-}
module
IHaskell.Display.Gnuplot
where
import
qualified
Graphics.Gnuplot.Plot
as
P
import
qualified
Graphics.Gnuplot.Frame
as
F
import
qualified
Graphics.Gnuplot.MultiPlot
as
M
import
qualified
Graphics.Gnuplot.Terminal.PNG
as
Pn
import
qualified
Graphics.Gnuplot.Terminal.SVG
as
Sv
import
qualified
Graphics.Gnuplot.Graph.TwoDimensional
as
Tw
import
qualified
Graphics.Gnuplot.Graph.ThreeDimensional
as
Th
import
qualified
Data.ByteString.Char8
as
Char
import
Graphics.Gnuplot.Advanced
(
plot
)
import
Graphics.Gnuplot.Value.Atom
(
C
)
import
Graphics.Gnuplot.Frame.OptionSet
(
size
,
deflt
)
import
IHaskell.Display
-- Plot-types
instance
(
C
x
,
C
y
)
=>
IHaskellDisplay
(
P
.
T
(
Tw
.
T
x
y
))
where
display
fig
=
do
pngDisp
<-
graphDataPNG2P
fig
svgDisp
<-
graphDataSVG2P
fig
return
$
Display
[
pngDisp
,
svgDisp
]
instance
(
C
x
,
C
y
,
C
z
)
=>
IHaskellDisplay
(
P
.
T
(
Th
.
T
x
y
z
))
where
display
fig
=
do
pngDisp
<-
graphDataPNG3P
fig
svgDisp
<-
graphDataSVG3P
fig
return
$
Display
[
pngDisp
,
svgDisp
]
-- Frame-types
instance
(
C
x
,
C
y
)
=>
IHaskellDisplay
(
F
.
T
(
Tw
.
T
x
y
))
where
display
fig
=
do
pngDisp
<-
graphDataPNG2F
fig
svgDisp
<-
graphDataSVG2F
fig
return
$
Display
[
pngDisp
,
svgDisp
]
instance
(
C
x
,
C
y
,
C
z
)
=>
IHaskellDisplay
(
F
.
T
(
Th
.
T
x
y
z
))
where
display
fig
=
do
pngDisp
<-
graphDataPNG3F
fig
svgDisp
<-
graphDataSVG3F
fig
return
$
Display
[
pngDisp
,
svgDisp
]
-- Type: Multiplot
instance
IHaskellDisplay
M
.
T
where
display
fig
=
do
pngDisp
<-
graphDataPNGM
fig
svgDisp
<-
graphDataSVGM
fig
return
$
Display
[
pngDisp
,
svgDisp
]
-- Filename
name
=
".ihaskell-gnuplot."
-- Width and height
w
=
300
h
=
300
graphDataPNG2P
::
(
C
x
,
C
y
)
=>
P
.
T
(
Tw
.
T
x
y
)
->
IO
DisplayData
graphDataPNG2P
graph
=
do
switchToTmpDir
-- Write the image.
let
fname
=
Pn
.
cons
$
name
++
"png"
plot
fname
graph
-- Read back, and convert to base64.
imgData
<-
Char
.
readFile
$
name
++
"png"
return
$
png
w
h
$
base64
imgData
graphDataSVG2P
::
(
C
x
,
C
y
)
=>
P
.
T
(
Tw
.
T
x
y
)
->
IO
DisplayData
graphDataSVG2P
graph
=
do
switchToTmpDir
-- Write the image.
let
fname
=
Sv
.
cons
$
name
++
"svg"
plot
fname
graph
-- Read back, and convert to base64.
imgData
<-
Char
.
readFile
$
name
++
"svg"
return
$
svg
$
Char
.
unpack
imgData
graphDataPNG2F
::
(
C
x
,
C
y
)
=>
F
.
T
(
Tw
.
T
x
y
)
->
IO
DisplayData
graphDataPNG2F
graph
=
do
switchToTmpDir
-- Write the image.
let
fname
=
Pn
.
cons
$
name
++
"png"
plot
fname
graph
-- Read back, and convert to base64.
imgData
<-
Char
.
readFile
$
name
++
"png"
return
$
png
w
h
$
base64
imgData
graphDataSVG2F
::
(
C
x
,
C
y
)
=>
F
.
T
(
Tw
.
T
x
y
)
->
IO
DisplayData
graphDataSVG2F
graph
=
do
switchToTmpDir
-- Write the image.
let
fname
=
Sv
.
cons
$
name
++
"svg"
plot
fname
graph
-- Read back, and convert to base64.
imgData
<-
Char
.
readFile
$
name
++
"svg"
return
$
svg
$
Char
.
unpack
imgData
graphDataPNG3P
::
(
C
x
,
C
y
,
C
z
)
=>
P
.
T
(
Th
.
T
x
y
z
)
->
IO
DisplayData
graphDataPNG3P
graph
=
do
switchToTmpDir
-- Write the image.
let
fname
=
Pn
.
cons
$
name
++
"png"
plot
fname
graph
-- Read back, and convert to base64.
imgData
<-
Char
.
readFile
$
name
++
"png"
return
$
png
w
h
$
base64
imgData
graphDataSVG3P
::
(
C
x
,
C
y
,
C
z
)
=>
P
.
T
(
Th
.
T
x
y
z
)
->
IO
DisplayData
graphDataSVG3P
graph
=
do
switchToTmpDir
-- Write the image.
let
fname
=
Sv
.
cons
$
name
++
"svg"
plot
fname
graph
-- Read back, and convert to base64.
imgData
<-
Char
.
readFile
$
name
++
"svg"
return
$
svg
$
Char
.
unpack
imgData
graphDataPNG3F
::
(
C
x
,
C
y
,
C
z
)
=>
F
.
T
(
Th
.
T
x
y
z
)
->
IO
DisplayData
graphDataPNG3F
graph
=
do
switchToTmpDir
-- Write the image.
let
fname
=
Pn
.
cons
$
name
++
"png"
plot
fname
graph
-- Read back, and convert to base64.
imgData
<-
Char
.
readFile
$
name
++
"png"
return
$
png
w
h
$
base64
imgData
graphDataSVG3F
::
(
C
x
,
C
y
,
C
z
)
=>
F
.
T
(
Th
.
T
x
y
z
)
->
IO
DisplayData
graphDataSVG3F
graph
=
do
switchToTmpDir
-- Write the image.
let
fname
=
Sv
.
cons
$
name
++
"svg"
plot
fname
graph
-- Read back, and convert to base64.
imgData
<-
Char
.
readFile
$
name
++
"svg"
return
$
svg
$
Char
.
unpack
imgData
graphDataPNGM
::
M
.
T
->
IO
DisplayData
graphDataPNGM
graph
=
do
switchToTmpDir
-- Write the image.
let
fname
=
Pn
.
cons
$
name
++
"png"
plot
fname
graph
-- Read back, and convert to base64.
imgData
<-
Char
.
readFile
$
name
++
"png"
return
$
png
w
h
$
base64
imgData
graphDataSVGM
::
M
.
T
->
IO
DisplayData
graphDataSVGM
graph
=
do
switchToTmpDir
-- Write the image.
let
fname
=
Sv
.
cons
$
name
++
"svg"
plot
fname
graph
-- Read back, and convert to base64.
imgData
<-
Char
.
readFile
$
name
++
"svg"
return
$
svg
$
Char
.
unpack
imgData
ihaskell-display/ihaskell-gnuplot/LICENSE
0 → 100644
View file @
1889f5cd
The MIT License (MIT)
Copyright (c) 2013 Andrew Gibiansky
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
ihaskell-display/ihaskell-gnuplot/Setup.hs
0 → 100644
View file @
1889f5cd
import
Distribution.Simple
main
=
defaultMain
ihaskell-display/ihaskell-gnuplot/ihaskell-gnuplot.cabal
0 → 100644
View file @
1889f5cd
-- The name of the package.
name: ihaskell-gnuplot
-- The package version. See the Haskell package versioning policy (PVP)
-- for standards guiding when and how versions should be incremented.
-- http://www.haskell.org/haskellwiki/Package_versioning_policy
-- PVP summary: +-+------- breaking API changes
-- | | +----- non-breaking API additions
-- | | | +--- code changes with no API change
version: 0.1.0.0
-- A short (one-line) description of the package.
synopsis: IHaskell display instance for Gnuplot (from gnuplot package)
-- A longer description of the package.
-- description:
-- URL for the project homepage or repository.
homepage: http://www.github.com/gibiansky/ihaskell
-- The license under which the package is released.
license: MIT
-- The file containing the license text.
license-file: LICENSE
-- The package author(s).
author: Doro Rose <dororose@hotmail.com>
-- An email address to which users can send suggestions, bug reports, and
-- patches.
maintainer: Doro Rose <dororose@hotmail.com>,
Andrew Gibiansky <andrew.gibiansky@gmail.com>
-- A copyright notice.
-- copyright:
category: Development
build-type: Simple
-- Extra files to be distributed with the package, such as examples or a
-- README.
-- extra-source-files:
-- Constraint on the version of Cabal needed to build this package.
cabal-version: >=1.16
library
-- Modules exported by the library.
exposed-modules: IHaskell.Display.Gnuplot
-- Modules included in this library but not exported.
-- other-modules:
-- Language extensions.
default-extensions: DoAndIfThenElse
OverloadedStrings
-- Other library packages from which modules are imported.
build-depends: base >=4.6 && <4.9,
bytestring,
gnuplot >= 0.5.4,
ihaskell >= 0.6.2
-- Directories containing source files.
-- hs-source-dirs:
-- Base language which the package is written in.
default-language: Haskell2010
ihaskell-display/ihaskell-gnuplot/stack.yaml
0 → 100644
View file @
1889f5cd
# For more information, see: https://github.com/commercialhaskell/stack/blob/release/doc/yaml_configuration.md
# Specifies the GHC version and set of packages available (e.g., lts-3.5, nightly-2015-09-21, ghc-7.10.2)
resolver
:
lts-3.14
# Local packages, usually specified by relative directory name
packages
:
-
'
.'
# Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3)
extra-deps
:
-
gnuplot-0.5.4
-
data-accessor-transformers-0.2.1.6
# Override default flag values for local packages and extra-deps
flags
:
{}
# Extra package databases containing global packages
extra-package-dbs
:
[]
# Control whether we use the GHC we find on the path
# system-ghc: true
# Require a specific version of stack, using version ranges
# require-stack-version: -any # Default
# require-stack-version: >= 1.0.0
# Override the architecture used by stack, especially useful on Windows
# arch: i386
# arch: x86_64
# Extra directories used by stack for building
# extra-include-dirs: [/path/to/dir]
# extra-lib-dirs: [/path/to/dir]
stack.yaml
View file @
1889f5cd
...
...
@@ -15,6 +15,7 @@ packages:
-
ihaskell-display/ihaskell-basic/
-
ihaskell-display/ihaskell-aeson/
-
ihaskell-display/ihaskell-hatex/
-
ihaskell-display/ihaskell-gnuplot/
extra-deps
:
-
magic-1.1
-
Rlang-QQ-0.3.1.0
...
...
@@ -24,4 +25,7 @@ extra-deps:
-
xformat-0.1.2.1
-
ratio-int-0.1.2
-
friday-0.2.2.0
-
haskell-src-exts-1.17.0
-
gnuplot-0.5.4
-
data-accessor-transformers-0.2.1.6
resolver
:
nightly-2016-03-25
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment