module Graphics.Gnuplot.Plot.TwoDimensional (
linearScale,
module Graphics.Gnuplot.Plot.TwoDimensional,
) where
import qualified Graphics.Gnuplot.Private.Graph2D as Graph
import qualified Graphics.Gnuplot.Private.Plot as Plot
import Graphics.Gnuplot.Utility
(functionToGraph, commaConcat, linearScale, )
import qualified Data.List.Match as Match
type T = Plot.T Graph.T
list :: Show a => [a] -> T
list dat =
Plot.withUniqueFile
(unlines (map show dat))
([Graph.deflt (Graph.Dim1 1)])
function :: Show a => [a] -> (a -> a) -> T
function args f =
path (functionToGraph args f)
functions :: Show a => [a] -> [a -> a] -> T
functions args fs =
let dat = map (\x -> (x, map ($ x) fs)) args
in Plot.withUniqueFile
(unlines (map (commaConcat . map show . uncurry (:)) dat))
(Match.take fs $
map (Graph.deflt . Graph.Dim2 1) [2..])
path :: Show a => [(a,a)] -> T
path dat =
Plot.withUniqueFile
(unlines (map (\(x,y) -> show x ++ ", " ++ show y) dat))
([Graph.deflt (Graph.Dim2 1 2)])
parameterFunction :: Show a => [a] -> (a -> (a,a)) -> T
parameterFunction args f = path (map f args)
listFromFile :: FilePath -> Int -> T
listFromFile filename column =
Plot.fromGraphs filename [Graph.deflt (Graph.Dim1 column)]
pathFromFile :: FilePath -> Int -> Int -> T
pathFromFile filename columnX columnY =
Plot.fromGraphs filename [Graph.deflt (Graph.Dim2 columnX columnY)]