-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A tiny plotting library, utilizes gnuplot for plotting. -- -- A tiny plotting library for Haskell, using gnuplot for rendering. -- -- Developed and tested using Mac OS X 10.7.3 with gnuplot 4.4 (via -- MacPorts). Compiles using GHC 7.0.4 -- -- Make sure gnuplot is in your path and everything should work. -- -- Some sample plots: -- --
-- plot X11 $ Data2D [Title "Sample Data"] [] [(1, 2), (2, 4), ...] ---- --
-- plot X11 $ Function2D [Title "Sine and Cosine"] [] (\x -> sin x * cos x) ---- --
-- plot X11 sin ---- --
-- plot (PNG "plot.png") (sin . cos) ---- --
-- plot X11 $ Gnuplot2D [Color Blue] [] "2**cos(x)" ---- --
-- plot X11 [ Data2D [Title "Graph 1", Color Red] [] [(x, x ** 3) | x <- [-4,-3.9..4]] -- , Function2D [Title "Function 2", Color Blue] [] (\x -> negate $ x ** 2) ] ---- --
-- plot' [Interactive] X11 $ Gnuplot3D [Color Magenta] [] "x ** 2 + y ** 3" --@package easyplot @version 1.0 -- | A simple wrapper to the gnuplot command line utility. -- -- Typically you will invoke a plot like so: -- --
-- plot X11 $ Data2D [Title "Sample Data"] [] [(1, 2), (2, 4), ...] ---- -- To plot a function, use the following: -- --
-- plot X11 $ Function2D [Title "Sine and Cosine"] [] (\x -> sin x * cos x) ---- -- There is also a shortcut available - the following plots the sine -- function: -- --
-- plot X11 sin ---- -- Output can go into a file, too (See TerminalType): -- --
-- plot (PNG "plot.png") (sin . cos) ---- -- Haskell functions are plotted via a set of tuples obtained form the -- function. If you want to make use of gnuplots mighty function plotting -- functions you can pass a Gnuplot2D or Gnuplot3D object -- to plot. -- --
-- plot X11 $ Gnuplot2D [Color Blue] [] "2**cos(x)" ---- -- For 3D-Plots there is a shortcut available by directly passing a -- String: -- --
-- plot X11 "x*y" ---- -- Multiple graphs can be shown simply by passing a list of these: -- --
-- plot X11 [ Data2D [Title "Graph 1", Color Red] [] [(x, x ** 3) | x <- [-4,-3.9..4]] -- , Function2D [Title "Function 2", Color Blue] [] (\x -> negate $ x ** 2) ] ---- -- For 3D Graphs it is useful to be able to interact with the graph (See -- plot' and GnuplotOption): -- --
-- plot' [Interactive] X11 $ Gnuplot3D [Color Magenta] [] "x ** 2 + y ** 3" ---- -- If you want to know the command that SimplePlot uses to plot your -- graph, turn on debugging: -- --
-- plot' [Debug] X11 $ Gnuplot3D [Color Magenta] [] "x ** 4 + y ** 3" -- > set term x11 persist; splot x ** 4 + y ** 3 lc rgb "magenta" --module Graphics.EasyPlot -- | Provides the plot function for different kinds of graphs (2D and 3D) class Plot a where plot = plot' [] plot :: Plot a => TerminalType -> a -> IO Bool plot' :: Plot a => [GnuplotOption] -> TerminalType -> a -> IO Bool -- | A two dimensional set of data to plot. data Graph2D x y -- | plots a Haskell function x -> y Function2D :: [Option] -> [Option2D x y] -> (x -> y) -> Graph2D x y -- | plots a set of tuples. Data2D :: [Option] -> [Option2D x y] -> [(x, y)] -> Graph2D x y -- | plots a custom function passed to Gnuplot (like x**2 + 10) Gnuplot2D :: [Option] -> [Option2D x y] -> String -> Graph2D x y -- | A three dimensional set of data to plot. data Graph3D x y z -- | plots a Haskell function x -> y -> z Function3D :: [Option] -> [Option3D x y z] -> (x -> y -> z) -> Graph3D x y z -- | plots a set of triples. Data3D :: [Option] -> [Option3D x y z] -> [(x, y, z)] -> Graph3D x y z -- | plots a custom function passed to Gnuplot (like x*y) Gnuplot3D :: [Option] -> [Option3D x y z] -> String -> Graph3D x y z -- | TerminalType determines where the output of gnuplot should go. data TerminalType -- | Output on Mac OS X (Aqua Terminal). Aqua :: TerminalType -- | Output for MS Windows. Windows :: TerminalType -- | Output to the X Window System. X11 :: TerminalType -- | Output into a Postscript file. PS :: FilePath -> TerminalType -- | Output into an EPS file. EPS :: FilePath -> TerminalType -- | Output as Portable Network Graphic into file. PNG :: FilePath -> TerminalType -- | Output as Portable Document Format into a file. PDF :: FilePath -> TerminalType -- | Output as Scalable Vector Graphic into a file. SVG :: FilePath -> TerminalType -- | Output as Graphics Interchange Format into a file. GIF :: FilePath -> TerminalType -- | Output into a JPEG file. JPEG :: FilePath -> TerminalType -- | Output as LaTeX. Latex :: FilePath -> TerminalType -- | The Color of a graph. data Color Red :: Color Blue :: Color Green :: Color Yellow :: Color Orange :: Color Magenta :: Color Cyan :: Color DarkRed :: Color DarkBlue :: Color DarkGreen :: Color DarkYellow :: Color DarkOrange :: Color DarkMagenta :: Color DarkCyan :: Color LightRed :: Color LightBlue :: Color LightGreen :: Color LightMagenta :: Color Violet :: Color White :: Color Brown :: Color Grey :: Color DarkGrey :: Color Black :: Color -- | a custom color RGB :: Int -> Int -> Int -> Color -- | The Style of a graph. data Style -- | points in the plot are interconnected by lines. Lines :: Style -- | data points are little cross symbols. Points :: Style -- | data points are real dots (approx the size of a pixel). Dots :: Style Impulses :: Style Linespoints :: Style -- | Options on how to render a graph. data Option -- | The style for a graph. Style :: Style -> Option -- | The title for a graph in a plot (or a filename like -- plot1.dat). Title :: String -> Option -- | The line-color for the graph (or if it consist of Dots or -- Points the color of these) Color :: Color -> Option -- | Options which are exclusively available for 2D plots. data Option2D x y -- | Plots the function for the specified x range Range :: x -> x -> Option2D x y -- | Plots the function only for the given x values For :: [x] -> Option2D x y -- | Uses the given step-size for plotting along the x-axis Step :: x -> Option2D x y -- | Options which are exclusively available for 3D plots. data Option3D x y z -- | Plots the function for the specified x range RangeX :: x -> x -> Option3D x y z -- | Plots the function for the specified y range RangeY :: y -> y -> Option3D x y z -- | Plots the function only for the given x values ForX :: [x] -> Option3D x y z -- | Plots the function only for the given y values ForY :: [y] -> Option3D x y z -- | Uses the given step-size for plotting along the x-axis StepX :: x -> Option3D x y z -- | Uses the given step-size for plotting along the y-axis StepY :: y -> Option3D x y z -- | Options which can be used with plot' data GnuplotOption -- | keeps gnuplot open, so that you can interact with the plot (only -- usefull with X11) Interactive :: GnuplotOption -- | prints the command used for running gnuplot. Debug :: GnuplotOption instance [incoherent] Eq GnuplotOption instance [incoherent] GnuplotIdiom Color instance [incoherent] GnuplotIdiom TerminalType instance [incoherent] GnuplotIdiom x => GnuplotIdiom [x] instance [incoherent] GnuplotIdiom Option instance [incoherent] GnuplotIdiom Style instance [incoherent] (Num x, Show x, Num y, Show y, Num z, Show z) => GnuplotIdiom (x, y, z) instance [incoherent] (Num x, Show x, Num y, Show y) => GnuplotIdiom (x, y) instance [incoherent] Plot [String] instance [incoherent] Plot String instance [incoherent] (Fractional x, Enum x, Show x, Fractional y, Enum y, Show y, Num z, Show z) => Plot [(x, y, z)] instance [incoherent] (Fractional x, Enum x, Num x, Show x, Num y, Show y) => Plot [(x, y)] instance [incoherent] (Fractional x, Enum x, Show x, Fractional y, Enum y, Show y, Num z, Show z) => Plot [x -> y -> z] instance [incoherent] (Fractional x, Enum x, Show x, Fractional y, Enum y, Show y, Num z, Show z) => Plot (x -> y -> z) instance [incoherent] (Fractional x, Enum x, Show x, Num y, Show y) => Plot [x -> y] instance [incoherent] (Fractional x, Enum x, Show x, Num y, Show y) => Plot (x -> y) instance [incoherent] (Fractional x, Enum x, Show x, Fractional y, Enum y, Show y, Num z, Show z) => Plot [Graph3D x y z] instance [incoherent] (Fractional x, Enum x, Show x, Fractional y, Enum y, Show y, Num z, Show z) => Plot (Graph3D x y z) instance [incoherent] (Fractional x, Enum x, Show x, Num y, Show y) => Plot [Graph2D x y] instance [incoherent] (Fractional x, Enum x, Show x, Num y, Show y) => Plot (Graph2D x y)