-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A plotting library, exportable as eps/pdf/svg/png or renderable with gtk -- -- A package for creating plots, built on top of the Cairo rendering -- engine. -- -- An ambitious attempt to replace gnuplot. -- -- Monadic actions are used to configure a figure, which is a (rxc) array -- of subplots. Each plot displays a graph with optional heading, labels, -- legend, and annotations. The annotations themselves may be used to -- draw diagrams. -- -- A figure is preprocessed in preparation for rendering by the Cairo -- renderer. The Cairo library can be used to output the figure to PS, -- PDF, SVG, and PNG file formats, or to display the figure in a GTK -- Drawable context. (see package 'plot-gtk'). -- -- The preprocessed figure can be embedded as an arbitrary Cairo render, -- including in a diagram created with the diagram package. Conversely, -- arbitrary Cairo renders can be embedded in the data region of a -- Figure. -- -- The data series are type Data.Packed.Vector from hmatrix, -- which, when hmatrix is compiled with '-fvector', is a synonym for -- Data.Vector.Storable from the vector package and are thus -- compatible with packages such as statistics. -- -- The example in Graphics.Rendering.Plot can be viewed at -- http://code.haskell.org/plot/examples/perturbed-sine.png -- -- Changes in plot 0.1.1 * added candle and whisker plots @package plot @version 0.1.1.3 -- | Rendering Figures module Graphics.Rendering.Plot.Render -- | render a Figure render :: Figure () -> (Int, Int) -> Render () -- | create FigureState from a series of Figure actions newFigureState :: Figure () -> IO FigureState -- | modify a FigureState with some new actions updateFigureState :: FigureState -> Figure () -> FigureState -- | render a FigureState renderFigureState :: FigureState -> (Int, Int) -> Render () -- | output file type data OutputType PNG :: OutputType PS :: OutputType PDF :: OutputType SVG :: OutputType -- | output the Figure writeFigure :: OutputType -> FilePath -> (Int, Int) -> Figure () -> IO () -- | output the FigureState writeFigureState :: OutputType -> FilePath -> (Int, Int) -> FigureState -> IO () -- | Creation and manipulation of Figures -- -- The same problem of leaked instances as at -- http://hackage.haskell.org/packages/archive/graphviz/2999.10.0.1/doc/html/Data-GraphViz-Commands.html#t%3AGraphvizCanvas -- occurs here. -- -- with, set, clear, new, and add are -- the operations that can be performed on various elements of a figure. -- -- glib/data-accessor abstractions (verbs/modifiers) are -- planned for future implementations module Graphics.Rendering.Plot.Figure data Figure a data FigureState -- | perform some actions on the text defaults, must be run before other -- text element modifications withTextDefaults :: Text () -> Figure () -- | perform some actions on the line defaults, must be run before other -- line element modifications withLineDefaults :: Line () -> Figure () -- | perform some actions on the point defaults, must be run before other -- point modifications withPointDefaults :: Point () -> Figure () -- | perform some actions on the bar defaults, must be run before other -- point modifications withBarDefaults :: Bar () -> Figure () -- | create a new blank Figure newFigure :: Figure () -- | set the padding of the figure setFigurePadding :: Double -> Double -> Double -> Double -> Figure () -- | operate on the title withTitle :: Text () -> Figure () -- | operate on the sub-title withSubTitle :: Text () -> Figure () -- | set the shape of the plots, losing all current plots setPlots :: Int -> Int -> Figure () -- | perform some actions on the specified subplot withPlot :: (Int, Int) -> Plot () -> Figure () -- | perform some actions all subplots withPlots :: Plot () -> Figure () data Plot a type Border = Bool -- | whether to draw a boundary around the plot area setBorder :: Border -> Plot () -- | set the padding of the subplot setPlotPadding :: Double -> Double -> Double -> Double -> Plot () -- | set the heading of the subplot withHeading :: Text () -> Plot () type Function = Double -> Double type Series = Vector Double type MinMaxSeries = (Series, Series) type ErrorSeries = Series type Surface = Matrix Double type SeriesLabel = String class Abscissa a class Ordinate a class Dataset a type FormattedSeries = Data DecoratedSeries data SeriesType Line :: SeriesType Point :: SeriesType LinePoint :: SeriesType Impulse :: SeriesType Step :: SeriesType Area :: SeriesType Bar :: SeriesType Hist :: SeriesType Candle :: SeriesType Whisker :: SeriesType line :: (Ordinate a, LineFormat b) => a -> b -> FormattedSeries point :: (Ordinate a, PointFormat b) => a -> b -> FormattedSeries linepoint :: (Ordinate a, LineFormat b, PointFormat c) => a -> b -> c -> FormattedSeries impulse :: (Ordinate a, LineFormat b) => a -> b -> FormattedSeries step :: (Ordinate a, LineFormat b) => a -> b -> FormattedSeries area :: (Ordinate a, LineFormat b) => a -> b -> FormattedSeries bar :: (Ordinate a, BarFormat b) => a -> b -> FormattedSeries hist :: (Ordinate a, BarFormat b) => a -> b -> FormattedSeries candle :: (Ordinate a, BarFormat b) => a -> b -> FormattedSeries whisker :: (Ordinate a, BarFormat b) => a -> b -> FormattedSeries -- | set the data series of the subplot setDataset :: (Dataset a) => a -> Plot () -- | set the plot type of a given data series setSeriesType :: Int -> SeriesType -> Plot () -- | change the plot type of all data series setAllSeriesTypes :: SeriesType -> Plot () class PlotFormats m -- | format the plot elements of a given series withSeriesFormat :: (PlotFormats m) => Int -> m () -> Plot () -- | format the plot elements of all series -- -- the operation to modify the formats is passed the series index. This -- allows, for example, colours to be selected from a list that gets -- indexed by the argument -- --
--   setColour = withAllSeriesFormats (\i -> do
--                                           setLineColour $ [black,blue,red,green,yellow] !! i
--                                           setLineWidth 1.0)
--   
withAllSeriesFormats :: (PlotFormats m) => (Int -> m ()) -> Plot () data Scale Linear :: Scale Log :: Scale -- | set the axis range setRange :: AxisType -> AxisSide -> Scale -> Double -> Double -> Plot () -- | set the axis ranges to values based on dataset setRangeFromData :: AxisType -> AxisSide -> Scale -> Plot () data Axis a data AxisType XAxis :: AxisType YAxis :: AxisType data AxisSide Lower :: AxisSide Upper :: AxisSide data AxisPosn Side :: AxisSide -> AxisPosn Value :: Double -> AxisPosn -- | clear the axes of a subplot clearAxes :: Plot () -- | clear an axis of a subplot clearAxis :: AxisType -> AxisPosn -> Plot () -- | add an axis to the subplot addAxis :: AxisType -> AxisPosn -> Axis () -> Plot () -- | operate on the given axis withAxis :: AxisType -> AxisPosn -> Axis () -> Plot () data Legend a type LegendBorder = Bool data LegendLocation North :: LegendLocation NorthEast :: LegendLocation East :: LegendLocation SouthEast :: LegendLocation South :: LegendLocation SouthWest :: LegendLocation West :: LegendLocation NorthWest :: LegendLocation data LegendOrientation Inside :: LegendOrientation Outside :: LegendOrientation -- | clear the legend clearLegend :: Plot () -- | set the legend location and orientation setLegend :: LegendBorder -> LegendLocation -> LegendOrientation -> Plot () -- | format the legend text withLegendFormat :: Text () -> Plot () data Tick Minor :: Tick Major :: Tick type TickValues = Either Int (Vector Double) type GridLines = Bool -- | format the axis ticks setTicks :: Tick -> TickValues -> Axis () -- | should gridlines be displayed? setGridlines :: Tick -> GridLines -> Axis () -- | printf format that takes one argument, the tick value setTickLabelFormat :: String -> Axis () -- | operate on the axis label withAxisLabel :: Text () -> Axis () -- | format the axis line withAxisLine :: Line () -> Axis () data Line a class LineFormat a type DashStyle = [Dash] data Dash Dot :: Dash Dash :: Dash type LineWidth = Double -- | clear the formatting of a line clearLineFormat :: Line () -- | change the dash style of a line setDashStyle :: DashStyle -> Line () -- | change the line width of a line setLineWidth :: LineWidth -> Line () -- | change the line colour of a line setLineColour :: Color -> Line () data Point a class PointFormat a data Glyph Box :: Glyph Cross :: Glyph Diamond :: Glyph Asterisk :: Glyph Triangle :: Glyph Circle :: Glyph Bullet :: Glyph Top :: Glyph Bot :: Glyph type PointSize = Double -- | change the glyph of a point setGlyph :: Glyph -> Point () -- | change the size of a point setPointSize :: PointSize -> Point () -- | change the colour of a point setPointColour :: Color -> Point () data Bar a class BarFormat a -- | clear the formatting of a line clearBarFormat :: Bar () -- | set the width of the bar setBarWidth :: Width -> Bar () -- | set the colour of the bar setBarColour :: Color -> Bar () -- | set the width of the bar border setBarBorderWidth :: LineWidth -> Bar () -- | set the colour of the bar border setBarBorderColour :: Color -> Bar () data Text a type FontFamily = String type FontSize = Double type Color = Colour Double -- | clear the text entry clearText :: Text () -- | set the text formatting to the default clearTextFormat :: Text () -- | set the value of a text entry setText :: String -> Text () -- | set the font style of a text entry setFontFamily :: FontFamily -> Text () -- | set the font style of a text entry setFontStyle :: FontStyle -> Text () -- | set the font variant of a text entry setFontVariant :: Variant -> Text () -- | set the font weight of a text entry setFontWeight :: Weight -> Text () -- | set the font stretch of a text entry setFontStretch :: Stretch -> Text () -- | set the font size of a text entry setFontSize :: FontSize -> Text () -- | set the colour of a text entry setFontColour :: Color -> Text () -- | One line Figure creation module Graphics.Rendering.Plot.Figure.Simple -- | create a figure with a single linear plot with lower X and Y axes -- whose ranges are set from the data plot :: (Dataset d) => d -> Figure () -- | create a figure with a single log-log plot with lower X and Y axes -- whose ranges are set from the data loglog :: (Dataset d) => d -> Figure () -- | create a figure with a single linear-log plot with lower X and Y axes -- whose ranges are set from the data semilog :: (Dataset d) => d -> Figure () -- | create a figure with a single parametric plot over n points with lower -- X and Y axes whose ranges are set from the data parametric :: (Double -> Double, Double -> Double) -> (Double, Double) -> Int -> Figure () -- | set the title title :: String -> Figure () -- | set the subtitle subtitle :: String -> Figure () class Simple m -- | set the gridlines grid :: (Simple m) => Bool -> m () -- | set the x range xrange :: (Simple m) => Scale -> Double -> Double -> m () -- | set the y range yrange :: (Simple m) => Scale -> Double -> Double -> m () -- | set the x range from data xautorange :: (Simple m) => m () -- | set the y range from data yautorange :: (Simple m) => m () -- | set the x range from data xautorangeLog :: (Simple m) => m () -- | set the y range from data yautorangeLog :: (Simple m) => m () -- | set the x label xlabel :: (Simple m) => String -> m () -- | set the y label ylabel :: (Simple m) => String -> m () instance Simple Figure instance Simple Plot -- | Graphical plots module Graphics.Rendering.Plot