-- 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 @package plot @version 0.2.3.8 -- | 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 background colour of the figure setBackgroundColour :: Color -> 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 -- | set the plot background colour setPlotBackgroundColour :: Color -> Plot () 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 VectorFunction = Vector Double -> Vector 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 -- -- The data series are either FormattedSeries or plain data -- series. A plain data series must carry a SeriesType. -- -- A dataset may or may not have an abscissa series, and if so, it is -- paired with either a list of ordinate series or a single ordinate -- series. -- -- The abscissa series (if present) is of type 'Vector Double'. -- -- An ordinate series be a function (Double -> Double) or a -- series of points, a 'Vector Double' with optional error series, y axis -- preference, and labels. -- -- To specify decoration options for an ordinate series, use the -- appropriate function, such as linespoints, with the ordinate -- series and decoration formatting (LineFormat, -- PointFormat, and BarFormat) as arguments. -- --
--   setDataset (ts,[linespoints (xs,(le,ue),Upper,"data") (([Dash,Dash],3,blue),(Diamond,green))])
--   
-- -- has abscissa ts paired with a list of ordinate series, the -- single element of which is a FormattedSeries, -- linespoints where the ordinate is xs with error -- series le and ue, to be graphed against the upper -- y-range with label "data". The line element is formatted to be dashed, -- of width 3, and blue and the point element is to be a green diamond. setDataset :: Dataset a => a -> Plot () type Location = (Double, Double) type Head = Bool type Fill = Bool data Annote a -- | add an arrow arrow :: Head -> Location -> Location -> Line () -> Annote () -- | add an oval oval :: Fill -> Location -> Location -> Bar () -> Annote () -- | add a rectangle rect :: Fill -> Location -> Location -> Bar () -> Annote () -- | add a rectangle glyph :: Location -> Point () -> Annote () -- | add text text :: Location -> Text () -> Annote () -- | add a cairo render that takes the bounding box (in user coordinates) -- as an argument cairo :: (Double -> Double -> Double -> Double -> Render ()) -> Annote () withAnnotations :: Annote () -> 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 BarSetting BarNone :: BarSetting BarSpread :: BarSetting BarStack :: BarSetting barSetting :: BarSetting -> Plot () type SampleData = Bool sampleData :: SampleData -> 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 data TickValues TickNumber :: Int -> TickValues TickValues :: (Vector Double) -> TickValues type GridLines = Bool data TickFormat DefaultTickFormat :: TickFormat Printf :: String -> TickFormat FormatFunction :: (Double -> String) -> TickFormat -- | format the axis ticks setTicks :: Tick -> TickValues -> Axis () -- | should gridlines be displayed? setGridlines :: Tick -> GridLines -> Axis () -- | set the tick label format setTickLabelFormat :: TickFormat -> Axis () -- | a list of data labels setTickLabels :: [String] -> Axis () -- | format the tick labels withTickLabelsFormat :: Text () -> Axis () -- | operate on the axis label withAxisLabel :: Text () -> Axis () -- | format the axis line withAxisLine :: Line () -> Axis () -- | format the grid lines withGridLine :: Tick -> 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 -- | Deprecated: use linlog semilog :: 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 linlog :: Dataset d => d -> Figure () -- | create a figure with a single log-linear plot with lower X and Y axes -- whose ranges are set from the data loglin :: 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 Graphics.Rendering.Plot.Figure.Simple.Simple Graphics.Rendering.Plot.Types.Plot instance Graphics.Rendering.Plot.Figure.Simple.Simple Graphics.Rendering.Plot.Types.Figure -- | 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 () -- | Graphical plots module Graphics.Rendering.Plot