Copyright | (c) A. V. H. McPhail 2010 |
---|---|
License | BSD3 |
Maintainer | haskell.vivian.mcphail <at> gmail <dot> com |
Stability | provisional |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Graphics.Rendering.Plot.Figure
Description
Creation and manipulation of Figure
s
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
Synopsis
- module Data.Colour.Names
- data Figure a
- data FigureState
- withTextDefaults :: Text () -> Figure ()
- withLineDefaults :: Line () -> Figure ()
- withPointDefaults :: Point () -> Figure ()
- withBarDefaults :: Bar () -> Figure ()
- newFigure :: Figure ()
- setBackgroundColour :: Color -> Figure ()
- setFigurePadding :: Double -> Double -> Double -> Double -> Figure ()
- withTitle :: Text () -> Figure ()
- withSubTitle :: Text () -> Figure ()
- setPlots :: Int -> Int -> Figure ()
- withPlot :: (Int, Int) -> Plot () -> Figure ()
- withPlots :: Plot () -> Figure ()
- data Plot a
- setPlotBackgroundColour :: Color -> Plot ()
- type Border = Bool
- setBorder :: Border -> Plot ()
- setPlotPadding :: Double -> Double -> Double -> Double -> Plot ()
- 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 :: (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
- setDataset :: Dataset a => a -> Plot ()
- type Location = (Double, Double)
- type Head = Bool
- type Fill = Bool
- data Annote a
- arrow :: Head -> Location -> Location -> Line () -> Annote ()
- oval :: Fill -> Location -> Location -> Bar () -> Annote ()
- rect :: Fill -> Location -> Location -> Bar () -> Annote ()
- glyph :: Location -> Point () -> Annote ()
- text :: Location -> Text () -> Annote ()
- cairo :: (Double -> Double -> Double -> Double -> Render ()) -> Annote ()
- withAnnotations :: Annote () -> Plot ()
- setSeriesType :: Int -> SeriesType -> Plot ()
- setAllSeriesTypes :: SeriesType -> Plot ()
- class PlotFormats (m :: Type -> Type)
- withSeriesFormat :: PlotFormats m => Int -> m () -> Plot ()
- withAllSeriesFormats :: PlotFormats m => (Int -> m ()) -> Plot ()
- data Scale
- setRange :: AxisType -> AxisSide -> Scale -> Double -> Double -> Plot ()
- setRangeFromData :: AxisType -> AxisSide -> Scale -> Plot ()
- data Axis a
- data AxisType
- data AxisSide
- data AxisPosn
- clearAxes :: Plot ()
- clearAxis :: AxisType -> AxisPosn -> Plot ()
- addAxis :: AxisType -> AxisPosn -> Axis () -> Plot ()
- withAxis :: AxisType -> AxisPosn -> Axis () -> Plot ()
- data BarSetting
- barSetting :: BarSetting -> Plot ()
- type SampleData = Bool
- sampleData :: SampleData -> Plot ()
- data Legend a
- type LegendBorder = Bool
- data LegendLocation
- data LegendOrientation
- clearLegend :: Plot ()
- setLegend :: LegendBorder -> LegendLocation -> LegendOrientation -> Plot ()
- withLegendFormat :: Text () -> Plot ()
- data Tick
- data TickValues
- = TickNumber Int
- | TickValues (Vector Double)
- type GridLines = Bool
- data TickFormat
- = DefaultTickFormat
- | Printf String
- | FormatFunction (Double -> String)
- setTicks :: Tick -> TickValues -> Axis ()
- setGridlines :: Tick -> GridLines -> Axis ()
- setTickLabelFormat :: TickFormat -> Axis ()
- setTickLabels :: [String] -> Axis ()
- withTickLabelsFormat :: Text () -> Axis ()
- withAxisLabel :: Text () -> Axis ()
- withAxisLine :: Line () -> Axis ()
- withGridLine :: Tick -> Line () -> Axis ()
- data Line a
- class LineFormat a
- type DashStyle = [Dash]
- data Dash
- type LineWidth = Double
- clearLineFormat :: Line ()
- setDashStyle :: DashStyle -> Line ()
- setLineWidth :: LineWidth -> Line ()
- setLineColour :: Color -> Line ()
- data Point a
- class PointFormat a
- data Glyph
- type PointSize = Double
- setGlyph :: Glyph -> Point ()
- setPointSize :: PointSize -> Point ()
- setPointColour :: Color -> Point ()
- data Bar a
- class BarFormat a
- clearBarFormat :: Bar ()
- setBarWidth :: Width -> Bar ()
- setBarColour :: Color -> Bar ()
- setBarBorderWidth :: LineWidth -> Bar ()
- setBarBorderColour :: Color -> Bar ()
- data Text a
- type FontFamily = String
- type FontSize = Double
- type Color = Colour Double
- clearText :: Text ()
- clearTextFormat :: Text ()
- setText :: String -> Text ()
- setFontFamily :: FontFamily -> Text ()
- setFontStyle :: FontStyle -> Text ()
- setFontVariant :: Variant -> Text ()
- setFontWeight :: Weight -> Text ()
- setFontStretch :: Stretch -> Text ()
- setFontSize :: FontSize -> Text ()
- setFontColour :: Color -> Text ()
Documentation
module Data.Colour.Names
Top level operation
Instances
Applicative Figure Source # | |
Functor Figure Source # | |
Monad Figure Source # | |
Simple Figure Source # | |
Defined in Graphics.Rendering.Plot.Figure.Simple | |
MonadState FigureState Figure Source # | |
Defined in Graphics.Rendering.Plot.Types Methods get :: Figure FigureState # put :: FigureState -> Figure () # state :: (FigureState -> (a, FigureState)) -> Figure a # |
data FigureState Source #
Instances
MonadState FigureState Figure Source # | |
Defined in Graphics.Rendering.Plot.Types Methods get :: Figure FigureState # put :: FigureState -> Figure () # state :: (FigureState -> (a, FigureState)) -> Figure a # |
Default options
withTextDefaults :: Text () -> Figure () Source #
perform some actions on the text defaults, must be run before other text element modifications
withLineDefaults :: Line () -> Figure () Source #
perform some actions on the line defaults, must be run before other line element modifications
withPointDefaults :: Point () -> Figure () Source #
perform some actions on the point defaults, must be run before other point modifications
withBarDefaults :: Bar () -> Figure () Source #
perform some actions on the bar defaults, must be run before other point modifications
Figures
Formatting
setBackgroundColour :: Color -> Figure () Source #
set the background colour of the figure
setFigurePadding :: Double -> Double -> Double -> Double -> Figure () Source #
set the padding of the figure
withSubTitle :: Text () -> Figure () Source #
operate on the sub-title
set the shape of the plots, losing all current plots
withPlot :: (Int, Int) -> Plot () -> Figure () Source #
perform some actions on the specified subplot
Sub-plots
Colour
setPlotBackgroundColour :: Color -> Plot () Source #
set the plot background colour
Plot elements
setPlotPadding :: Double -> Double -> Double -> Double -> Plot () Source #
set the padding of the subplot
withHeading :: Text () -> Plot () Source #
set the heading of the subplot
Series data
type MinMaxSeries = (Series, Series) Source #
type ErrorSeries = Series Source #
type SeriesLabel = String Source #
Minimal complete definition
toAbscissa
Instances
Abscissa Series Source # | |
Defined in Graphics.Rendering.Plot.Figure.Plot.Data Methods toAbscissa :: Series -> Abscissae |
Minimal complete definition
toOrdinate
Instances
Minimal complete definition
toDataSeries
Instances
type FormattedSeries = Data DecoratedSeries Source #
data SeriesType Source #
Instances
(Abscissa a, Ordinate b) => Dataset [(SeriesType, a, b)] Source # | |
Defined in Graphics.Rendering.Plot.Figure.Plot.Data Methods toDataSeries :: [(SeriesType, a, b)] -> Data DataSeries | |
Ordinate a => Dataset (SeriesType, [a]) Source # | |
Defined in Graphics.Rendering.Plot.Figure.Plot.Data Methods toDataSeries :: (SeriesType, [a]) -> Data DataSeries | |
(Abscissa a, Ordinate b) => Dataset (SeriesType, a, [b]) Source # | |
Defined in Graphics.Rendering.Plot.Figure.Plot.Data Methods toDataSeries :: (SeriesType, a, [b]) -> Data DataSeries |
line :: (Ordinate a, LineFormat b) => a -> b -> FormattedSeries Source #
point :: (Ordinate a, PointFormat b) => a -> b -> FormattedSeries Source #
linepoint :: (Ordinate a, LineFormat b, PointFormat c) => a -> b -> c -> FormattedSeries Source #
impulse :: (Ordinate a, LineFormat b) => a -> b -> FormattedSeries Source #
step :: (Ordinate a, LineFormat b) => a -> b -> FormattedSeries Source #
area :: (Ordinate a, LineFormat b) => a -> b -> FormattedSeries Source #
setDataset :: Dataset a => a -> Plot () Source #
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.
Annotations
cairo :: (Double -> Double -> Double -> Double -> Render ()) -> Annote () Source #
add a cairo render that takes the bounding box (in user coordinates) as an argument
withAnnotations :: Annote () -> Plot () Source #
Plot type
setSeriesType :: Int -> SeriesType -> Plot () Source #
set the plot type of a given data series
setAllSeriesTypes :: SeriesType -> Plot () Source #
change the plot type of all data series
Formatting
class PlotFormats (m :: Type -> Type) Source #
Minimal complete definition
modifyFormat
Instances
PlotFormats Bar Source # | |
Defined in Graphics.Rendering.Plot.Figure.Plot.Data Methods modifyFormat :: Bar () -> DecoratedSeries -> Data DecoratedSeries | |
PlotFormats Line Source # | |
Defined in Graphics.Rendering.Plot.Figure.Plot.Data Methods modifyFormat :: Line () -> DecoratedSeries -> Data DecoratedSeries | |
PlotFormats Point Source # | |
Defined in Graphics.Rendering.Plot.Figure.Plot.Data Methods modifyFormat :: Point () -> DecoratedSeries -> Data DecoratedSeries |
withSeriesFormat :: PlotFormats m => Int -> m () -> Plot () Source #
format the plot elements of a given series
withAllSeriesFormats :: PlotFormats m => (Int -> m ()) -> Plot () Source #
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)
Range
setRangeFromData :: AxisType -> AxisSide -> Scale -> Plot () Source #
set the axis ranges to values based on dataset
Axes
Instances
BarSetting
barSetting :: BarSetting -> Plot () Source #
Data Sampling
type SampleData = Bool Source #
sampleData :: SampleData -> Plot () Source #
Legend
type LegendBorder = Bool Source #
data LegendLocation Source #
Instances
Eq LegendLocation Source # | |
Defined in Graphics.Rendering.Plot.Types Methods (==) :: LegendLocation -> LegendLocation -> Bool # (/=) :: LegendLocation -> LegendLocation -> Bool # |
data LegendOrientation Source #
clearLegend :: Plot () Source #
clear the legend
setLegend :: LegendBorder -> LegendLocation -> LegendOrientation -> Plot () Source #
set the legend location and orientation
withLegendFormat :: Text () -> Plot () Source #
format the legend text
Formatting
data TickValues Source #
Constructors
TickNumber Int | |
TickValues (Vector Double) |
data TickFormat Source #
Constructors
DefaultTickFormat | |
Printf String | |
FormatFunction (Double -> String) |
setTickLabelFormat :: TickFormat -> Axis () Source #
set the tick label format
setTickLabels :: [String] -> Axis () Source #
a list of data labels
withTickLabelsFormat :: Text () -> Axis () Source #
format the tick labels
withAxisLabel :: Text () -> Axis () Source #
operate on the axis label
withAxisLine :: Line () -> Axis () Source #
format the axis line
Lines
Instances
Applicative Line Source # | |
Functor Line Source # | |
Monad Line Source # | |
PlotFormats Line Source # | |
Defined in Graphics.Rendering.Plot.Figure.Plot.Data Methods modifyFormat :: Line () -> DecoratedSeries -> Data DecoratedSeries |
class LineFormat a Source #
Minimal complete definition
toLine
Instances
Instances
Eq Dash Source # | |
LineFormat DashStyle Source # | |
Defined in Graphics.Rendering.Plot.Figure.Line Methods toLine :: (MonadReader Options m, MonadSupply SupplyData m) => DashStyle -> m LineType | |
Real a => LineFormat (DashStyle, Colour a) Source # | |
Defined in Graphics.Rendering.Plot.Figure.Line Methods toLine :: (MonadReader Options m, MonadSupply SupplyData m) => (DashStyle, Colour a) -> m LineType | |
LineFormat (DashStyle, LineWidth) Source # | |
Defined in Graphics.Rendering.Plot.Figure.Line Methods toLine :: (MonadReader Options m, MonadSupply SupplyData m) => (DashStyle, LineWidth) -> m LineType | |
Real a => LineFormat (DashStyle, LineWidth, Colour a) Source # | |
Defined in Graphics.Rendering.Plot.Figure.Line Methods toLine :: (MonadReader Options m, MonadSupply SupplyData m) => (DashStyle, LineWidth, Colour a) -> m LineType |
clearLineFormat :: Line () Source #
clear the formatting of a line
setDashStyle :: DashStyle -> Line () Source #
change the dash style of a line
setLineWidth :: LineWidth -> Line () Source #
change the line width of a line
setLineColour :: Color -> Line () Source #
change the line colour of a line
Points
Instances
Applicative Point Source # | |
Functor Point Source # | |
Monad Point Source # | |
PlotFormats Point Source # | |
Defined in Graphics.Rendering.Plot.Figure.Plot.Data Methods modifyFormat :: Point () -> DecoratedSeries -> Data DecoratedSeries |
class PointFormat a Source #
Minimal complete definition
toPoint
Instances
PointFormat Glyph Source # | |
Defined in Graphics.Rendering.Plot.Figure.Point Methods toPoint :: (MonadReader Options m, MonadSupply SupplyData m) => Glyph -> m PointType | |
Real a => PointFormat (Colour a) Source # | |
Defined in Graphics.Rendering.Plot.Figure.Point Methods toPoint :: (MonadReader Options m, MonadSupply SupplyData m) => Colour a -> m PointType | |
Real a => PointFormat (Glyph, Colour a) Source # | |
Defined in Graphics.Rendering.Plot.Figure.Point Methods toPoint :: (MonadReader Options m, MonadSupply SupplyData m) => (Glyph, Colour a) -> m PointType | |
PointFormat (Glyph, PointSize) Source # | |
Defined in Graphics.Rendering.Plot.Figure.Point Methods toPoint :: (MonadReader Options m, MonadSupply SupplyData m) => (Glyph, PointSize) -> m PointType | |
Real a => PointFormat (Glyph, PointSize, Colour a) Source # | |
Defined in Graphics.Rendering.Plot.Figure.Point Methods toPoint :: (MonadReader Options m, MonadSupply SupplyData m) => (Glyph, PointSize, Colour a) -> m PointType |
Instances
PointFormat Glyph Source # | |
Defined in Graphics.Rendering.Plot.Figure.Point Methods toPoint :: (MonadReader Options m, MonadSupply SupplyData m) => Glyph -> m PointType | |
Real a => PointFormat (Glyph, Colour a) Source # | |
Defined in Graphics.Rendering.Plot.Figure.Point Methods toPoint :: (MonadReader Options m, MonadSupply SupplyData m) => (Glyph, Colour a) -> m PointType | |
PointFormat (Glyph, PointSize) Source # | |
Defined in Graphics.Rendering.Plot.Figure.Point Methods toPoint :: (MonadReader Options m, MonadSupply SupplyData m) => (Glyph, PointSize) -> m PointType | |
Real a => PointFormat (Glyph, PointSize, Colour a) Source # | |
Defined in Graphics.Rendering.Plot.Figure.Point Methods toPoint :: (MonadReader Options m, MonadSupply SupplyData m) => (Glyph, PointSize, Colour a) -> m PointType |
setPointSize :: PointSize -> Point () Source #
change the size of a point
setPointColour :: Color -> Point () Source #
change the colour of a point
Bars
Instances
Applicative Bar Source # | |
Functor Bar Source # | |
Monad Bar Source # | |
PlotFormats Bar Source # | |
Defined in Graphics.Rendering.Plot.Figure.Plot.Data Methods modifyFormat :: Bar () -> DecoratedSeries -> Data DecoratedSeries |
Minimal complete definition
toBar
Instances
Real a => BarFormat (Colour a) Source # | |
Defined in Graphics.Rendering.Plot.Figure.Bar Methods toBar :: (MonadReader Options m, MonadSupply SupplyData m) => Colour a -> m BarType |
clearBarFormat :: Bar () Source #
clear the formatting of a line
setBarWidth :: Width -> Bar () Source #
set the width of the bar
setBarColour :: Color -> Bar () Source #
set the colour of the bar
setBarBorderWidth :: LineWidth -> Bar () Source #
set the width of the bar border
setBarBorderColour :: Color -> Bar () Source #
set the colour of the bar border
Text labels
type FontFamily = String Source #
A text element must exist for formatting to work
clearTextFormat :: Text () Source #
set the text formatting to the default
setFontFamily :: FontFamily -> Text () Source #
set the font style of a text entry
setFontStyle :: FontStyle -> Text () Source #
set the font style of a text entry
setFontVariant :: Variant -> Text () Source #
set the font variant of a text entry
setFontWeight :: Weight -> Text () Source #
set the font weight of a text entry
setFontStretch :: Stretch -> Text () Source #
set the font stretch of a text entry
setFontSize :: FontSize -> Text () Source #
set the font size of a text entry
setFontColour :: Color -> Text () Source #
set the colour of a text entry