-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | 2D and 3D plots using gnuplot -- -- This is a wrapper to gnuplot which lets you create 2D and 3D plots. -- -- Start a simple session with make ghci. This loads the module -- Graphics.Gnuplot.Simple which is ready for use in GHCi. It does -- not address all fancy gnuplot features in order to stay simple. For -- more sophisticated plots, especially batch generated graphics, I -- recommend Graphics.Gnuplot.Advanced. This module contains also -- an overview of the hierarchy of objects. Examples for using this -- interface can be found in the Demo module. -- -- With the Cabal flags executePipe and executeShell you can switch to -- more convenient but probably less portable ways of feeding gnuplot -- with a script. @package gnuplot @version 0.3.4 module Graphics.Gnuplot.Frame.Option newtype T Cons :: String -> T newtype T Cons :: String -> T custom :: String -> T title :: T grid :: T size :: T key :: T border :: T pm3d :: T view :: T xRange :: T yRange :: T zRange :: T xLabel :: T yLabel :: T zLabel :: T xTicks :: T yTicks :: T zTicks :: T module Graphics.Gnuplot.Time -- | Use it this way: -- --
--   import Data.Time
--   import Graphics.Gnuplot.Simple
--   
--   main =
--      plotPath [XTime, XFormat "%m-%d"] $ prepXTime $
--         (UTCTime (fromGregorian 2008 01 01)     0, 1.0) :
--         (UTCTime (fromGregorian 2008 01 05) 43200, 5.0) :
--         (UTCTime (fromGregorian 2008 01 15)     0, 2.5) :
--         []
--   
prepXTime :: (FormatTime a, Read b) => [(a, b)] -> [(b, b)] -- | Modularized interface to gnuplot that allows complex graphics and fine -- control of their components. It is designed for non-interactive use, -- e.g. scripts for plotting statistics. -- -- The hierarchy of objects is as follows: -- -- -- -- Although the Haskell wrapper shall save you from the burden of -- learning gnuplot script syntax, it happens frequently that people ask, -- how to express a certain gnuplot script using this package. Thus let's -- annotate the gnuplot script generated by Demo.multiplot2d in -- order to show, what belongs to where: -- --
--   # the terminal selection is part of the 'plot' command of this module
--   set terminal x11
--   # multiplot initialization belongs to MultiPlot - of course
--   set multiplot layout 3, 5
--   # hiding the names of the temporary files is a FrameOption
--   unset key
--   set xrange [-1.0:1.0]
--   # this plot contains only one graph,
--   # but several graphs could be given separated by commas
--   plot "curve0.csv" using 1:2 with lines
--   plot "curve1.csv" using 1:2 with lines
--   plot "curve2.csv" using 1:2 with lines
--   plot "curve3.csv" using 1:2 with lines
--   plot "curve4.csv" using 1:2 with lines
--   plot "curve5.csv" using 1:2 with lines
--   plot "curve6.csv" using 1:2 with lines
--   set xrange [-2.5:2.5]
--   set yrange [-2.5:2.5]
--   # this is a plot build from a Graph3D
--   splot "curve7.csv" using 1:2:3 with pm3d
--   set xrange [-1.0:1.0]
--   set yrange [*:*]
--   plot "curve8.csv" using 1:2 with lines
--   plot "curve9.csv" using 1:2 with lines
--   plot "curve10.csv" using 1:2 with lines
--   plot "curve11.csv" using 1:2 with lines
--   plot "curve12.csv" using 1:2 with lines
--   plot "curve13.csv" using 1:2 with lines
--   plot "curve14.csv" using 1:2 with lines
--   unset multiplot
--   
module Graphics.Gnuplot.Advanced -- | The plot function returns ExitCode, which is nice for -- programming but ugly for interactive GHCi sessions. For interactive -- sessions, better use Graphics.Gnuplot.Simple. gfx must -- be one of the types Plot, Frame, MultiPlot. plot :: (C terminal, C gfx) => terminal -> gfx -> IO ExitCode module Graphics.Gnuplot.Terminal.PostScript data T cons :: FilePath -> T landscape :: T -> T portrait :: T -> T eps :: T -> T color :: T -> T monochrome :: T -> T instance C T module Graphics.Gnuplot.Terminal.PNG data T cons :: FilePath -> T transparent :: T -> T noTransparent :: T -> T interlace :: T -> T noInterlace :: T -> T trueColor :: T -> T noTrueColor :: T -> T fontTiny :: T -> T fontSmall :: T -> T fontMedium :: T -> T fontLarge :: T -> T fontGiant :: T -> T instance C T module Graphics.Gnuplot.Terminal.SVG data T cons :: FilePath -> T instance C T module Graphics.Gnuplot.Terminal.X11 data T cons :: T title :: String -> T -> T noTitle :: T -> T persist :: T -> T noPersist :: T -> T instance C T module Graphics.Gnuplot.Frame data T graph cons :: T graph -> T graph -> T graph simple :: T graph -> T graph empty :: T T module Graphics.Gnuplot.MultiPlot data T data Part partFromFrame :: (C graph) => T graph -> Part partFromPlot :: (C graph) => T graph -> Part simpleFromFrameArray :: (C graph, Ix i, Ix j) => Array (i, j) (T graph) -> T simpleFromPartArray :: (Ix i, Ix j) => Array (i, j) Part -> T instance C T module Graphics.Gnuplot.Graph.TwoDimensional data T type Type = T defaultType :: Type deflt :: Column -> T typ :: Type -> T -> T lineSpec :: T -> T -> T lines :: T points :: T linesPoints :: T impulses :: T dots :: T steps :: T fSteps :: T hiSteps :: T errorBars :: T xErrorBars :: T yErrorBars :: T xyErrorBars :: T errorLines :: T xErrorLines :: T yErrorLines :: T xyErrorLines :: T boxes :: T filledCurves :: T boxErrorBars :: T boxXYErrorBars :: T financeBars :: T candleSticks :: T vectors :: T module Graphics.Gnuplot.Graph.ThreeDimensional data T type Type = T defaultType :: Type deflt :: Column -> T typ :: Type -> T -> T lineSpec :: T -> T -> T lines :: T points :: T linesPoints :: T impulses :: T dots :: T steps :: T fSteps :: T hiSteps :: T errorBars :: T xErrorBars :: T yErrorBars :: T xyErrorBars :: T errorLines :: T xErrorLines :: T yErrorLines :: T xyErrorLines :: T boxes :: T filledCurves :: T boxErrorBars :: T boxXYErrorBars :: T financeBars :: T candleSticks :: T vectors :: T pm3d :: T module Graphics.Gnuplot.Frame.OptionSet data T graph -- | The default options contain what we expect as default value in -- gnuplot. We need an entry for every option that cannot be reset by -- unset. deflt :: T graph -- | Add an option with arguments as plain strings. This is very flexible, -- but not very safe. Use it only as fall-back, if there is no specific -- setter function in Graphics.Gnuplot.Frame.OptionSet. add :: T -> [String] -> T graph -> T graph -- | Remove an option. remove :: T -> T graph -> T graph size :: (C graph) => Double -> Double -> T graph -> T graph title :: (C graph) => String -> T graph -> T graph xRange :: (C graph) => (Double, Double) -> T graph -> T graph yRange :: (C graph) => (Double, Double) -> T graph -> T graph zRange :: (Double, Double) -> T T -> T T xLabel :: (C graph) => String -> T graph -> T graph yLabel :: (C graph) => String -> T graph -> T graph zLabel :: String -> T T -> T T -- | Set parameters of viewing a surface graph. See -- info:gnuplot/view view :: Double -> Double -> Double -> Double -> T T -> T T -- | Show flat pixel map. viewMap :: T T -> T T module Graphics.Gnuplot.LineSpecification data T deflt :: T lineStyle :: Int -> T -> T lineType :: Int -> T -> T lineWidth :: Double -> T -> T pointType :: Int -> T -> T pointSize :: Double -> T -> T title :: String -> T -> T module Graphics.Gnuplot.Plot.ThreeDimensional linearScale :: (Fractional a) => Integer -> (a, a) -> [a] -- | Plots can be assembled using mappend or mconcat. type T = T T mesh :: (Show a, Show b, Show c) => [[(a, b, c)]] -> T function :: (Show a, Show b, Show c) => [b] -> [c] -> (b -> c -> a) -> T module Graphics.Gnuplot.Plot.TwoDimensional linearScale :: (Fractional a) => Integer -> (a, a) -> [a] -- | Plots can be assembled using mappend or mconcat. type T = T T -- |
--   list (take 30 (let fibs = 0 : 1 : zipWith (+) fibs (tail fibs) in fibs))
--   
list :: (Show a) => [a] -> T -- |
--   function (linearScale 1000 (-10,10)) sin
--   
function :: (Show a) => [a] -> (a -> a) -> T -- |
--   functions (linearScale 1000 (-10,10)) [sin, cos]
--   
functions :: (Show a) => [a] -> [a -> a] -> T path :: (Show a) => [(a, a)] -> T -- |
--   parameterFunction (linearScale 1000 (0,2*pi)) (\t -> (sin (2*t), cos t))
--   
parameterFunction :: (Show a) => [a] -> (a -> (a, a)) -> T listFromFile :: FilePath -> Int -> T pathFromFile :: FilePath -> Int -> Int -> T -- | This is a simple monolithic interface to gnuplot that can be used as -- is in GHCi or Hugs. We do not plan to support every feature of gnuplot -- here, instead we provide an advanced modularized interface in -- Graphics.Gnuplot.Advanced. -- -- This was formerly part of the htam package. module Graphics.Gnuplot.Simple data Attribute -- | anything that is allowed after gnuplot's set command Custom :: String -> [String] -> Attribute EPS :: FilePath -> Attribute PNG :: FilePath -> Attribute -- | you cannot use this, call terminal instead Terminal :: T -> Attribute Grid :: (Maybe [String]) -> Attribute Key :: (Maybe [String]) -> Attribute Border :: (Maybe [String]) -> Attribute XTicks :: (Maybe [String]) -> Attribute YTicks :: (Maybe [String]) -> Attribute Size :: (Size) -> Attribute Aspect :: (Aspect) -> Attribute BoxAspect :: (Aspect) -> Attribute LineStyle :: Int -> [LineAttr] -> Attribute Title :: String -> Attribute XLabel :: String -> Attribute YLabel :: String -> Attribute XRange :: (Double, Double) -> Attribute YRange :: (Double, Double) -> Attribute ZRange :: (Double, Double) -> Attribute Palette :: [(Double, (Double, Double, Double))] -> Attribute ColorBox :: (Maybe [String]) -> Attribute XTime :: Attribute XFormat :: String -> Attribute data Size Scale :: Double -> Size SepScale :: Double -> Double -> Size data Aspect Ratio :: Double -> Aspect NoRatio :: Aspect data LineAttr LineType :: Int -> LineAttr LineWidth :: Double -> LineAttr PointType :: Int -> LineAttr PointSize :: Double -> LineAttr LineTitle :: String -> LineAttr data LineSpec DefaultStyle :: Int -> LineSpec CustomStyle :: [LineAttr] -> LineSpec data PlotType Lines :: PlotType Points :: PlotType LinesPoints :: PlotType Impulses :: PlotType Dots :: PlotType Steps :: PlotType FSteps :: PlotType HiSteps :: PlotType ErrorBars :: PlotType XErrorBars :: PlotType YErrorBars :: PlotType XYErrorBars :: PlotType ErrorLines :: PlotType XErrorLines :: PlotType YErrorLines :: PlotType XYErrorLines :: PlotType Boxes :: PlotType FilledCurves :: PlotType BoxErrorBars :: PlotType BoxXYErrorBars :: PlotType FinanceBars :: PlotType CandleSticks :: PlotType Vectors :: PlotType PM3d :: PlotType data PlotStyle PlotStyle :: PlotType -> LineSpec -> PlotStyle plotType :: PlotStyle -> PlotType lineSpec :: PlotStyle -> LineSpec linearScale :: (Fractional a) => Integer -> (a, a) -> [a] defaultStyle :: PlotStyle terminal :: (C term) => term -> Attribute -- |
--   plotList [] (take 30 (let fibs = 0 : 1 : zipWith (+) fibs (tail fibs) in fibs))
--   
plotList :: (Show a) => [Attribute] -> [a] -> IO () plotListStyle :: (Show a) => [Attribute] -> PlotStyle -> [a] -> IO () plotLists :: (Show a) => [Attribute] -> [[a]] -> IO () plotListsStyle :: (Show a) => [Attribute] -> [(PlotStyle, [a])] -> IO () -- |
--   plotFunc [] (linearScale 1000 (-10,10)) sin
--   
plotFunc :: (Show a) => [Attribute] -> [a] -> (a -> a) -> IO () -- |
--   plotFuncs [] (linearScale 1000 (-10,10)) [sin, cos]
--   
plotFuncs :: (Show a) => [Attribute] -> [a] -> [a -> a] -> IO () plotPath :: (Show a) => [Attribute] -> [(a, a)] -> IO () plotPaths :: (Show a) => [Attribute] -> [[(a, a)]] -> IO () plotPathStyle :: (Show a) => [Attribute] -> PlotStyle -> [(a, a)] -> IO () plotPathsStyle :: (Show a) => [Attribute] -> [(PlotStyle, [(a, a)])] -> IO () -- |
--   plotParamFunc [] (linearScale 1000 (0,2*pi)) (\t -> (sin (2*t), cos t))
--   
plotParamFunc :: (Show a) => [Attribute] -> [a] -> (a -> (a, a)) -> IO () -- |
--   plotParamFuncs [] (linearScale 1000 (0,2*pi)) [\t -> (sin (2*t), cos t), \t -> (cos t, sin (2*t))]
--   
plotParamFuncs :: (Show a) => [Attribute] -> [a] -> [a -> (a, a)] -> IO () plotDots :: (Show a) => [Attribute] -> [(a, a)] -> IO () data Plot3dType Surface :: Plot3dType ColorMap :: Plot3dType data CornersToColor Mean :: CornersToColor GeometricMean :: CornersToColor Median :: CornersToColor Corner1 :: CornersToColor Corner2 :: CornersToColor Corner3 :: CornersToColor Corner4 :: CornersToColor data Attribute3d Plot3dType :: Plot3dType -> Attribute3d CornersToColor :: CornersToColor -> Attribute3d -- |
--   let xs = [-2,-1.8..2::Double] in plotMesh3d [] [] (do x <- xs; return (do y <- xs; return (x,y,cos(x*x+y*y))))
--   
plotMesh3d :: (Show a, Show b, Show c) => [Attribute] -> [Attribute3d] -> [[(a, b, c)]] -> IO () -- |
--   let xs = [-2,-1.8..2::Double] in plotFunc3d [] [] xs xs (\x y -> exp(-(x*x+y*y)))
--   
plotFunc3d :: (Show a, Show b, Show c) => [Attribute] -> [Attribute3d] -> [b] -> [c] -> (b -> c -> a) -> IO () -- | Redirects the output of a plotting function to an EPS file and -- additionally converts it to PDF. epspdfPlot :: FilePath -> ([Attribute] -> IO ()) -> IO () -- | Creates an EPS and a PDF graphics and returns a string that can be -- inserted into a LaTeX document to include this graphic. -- -- Different from GHCi, Hugs doesn't output a return value from an IO -- monad. So you must wrap it with a putStr. Nevertheless this -- implementation which returns the LaTeX command as string is the most -- flexible one. inclPlot :: FilePath -> ([Attribute] -> IO ()) -> IO String