-- 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. -- -- In the past this was part of the htam package. @package gnuplot @version 0.1 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)] module Graphics.GNUPlot.Simple data Attribute EPS :: FilePath -> 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 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 type PlotStyle = (PlotType, LineSpec) linearScale :: (Fractional a) => Integer -> (a, a) -> [a] defaultStyle :: PlotStyle -- |
-- 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 :: (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 tmpFile :: FilePath tmpFileStem :: FilePath showTriplet :: (Show a, Show b, Show c) => (a, b, c) -> String semiColonConcat :: [String] -> String commaConcat :: [String] -> String attrToProg :: Attribute -> String yRangeFromAttr :: Attribute -> Maybe (Double, Double) zRangeFromAttr :: Attribute -> Maybe (Double, Double) xRangeFromAttr :: Attribute -> Maybe (Double, Double) extractRanges :: [Attribute] -> String lineAttrToString :: LineAttr -> String lineSpecToString :: LineSpec -> String plotTypeToString :: PlotType -> String plotStyleToString :: PlotStyle -> String plot3dTypeToString :: Plot3dType -> String cornersToColorToString :: CornersToColor -> String attribute3dToString :: Attribute3d -> String -- | Writes point data to a file and returns a string containing -- GNUPlot.plot parameters to invoke the file. storeData :: (Show a) => FilePath -> PlotStyle -> [(a, a)] -> IO String plot2dGen :: (Show a) => [Attribute] -> PlotStyle -> [(a, a)] -> IO () plot2dMultiGen :: (Show a) => [Attribute] -> [(PlotStyle, [(a, a)])] -> IO () plot2dMultiSharedAbscissa :: (Show a) => [Attribute] -> [PlotStyle] -> [(a, [a])] -> IO () quote :: String -> String callGNUPlot :: [Attribute] -> String -> [String] -> IO ExitCode startGNUPlot :: String -> String -> IO ExitCode