plots-0.1.1.1: Diagrams based plotting library.

Copyright(C) 2016 Christopher Chalmers
LicenseBSD-style (see the file LICENSE)
MaintainerChristopher Chalmers
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Plots.Style

Contents

Description

This module defines the AxisStyle type along with different colour schemes. AxisStyles are used to provide default colours and shapes for the plots of an axis.

Synopsis

The axis style

data AxisStyle v Source #

The AxisStyle determines the Styles of the plots in an axis. There are various predefined styles to change the look of the plot.

Instances
Applicative f => HasPlotStyle f (AxisStyle v) Source # 
Instance details

Defined in Plots.Style

HasAxisStyle (AxisStyle v) Source # 
Instance details

Defined in Plots.Style

type N (AxisStyle v) Source # 
Instance details

Defined in Plots.Style

type N (AxisStyle v) = Double
type V (AxisStyle v) Source # 
Instance details

Defined in Plots.Style

type V (AxisStyle v) = v

class HasAxisStyle a where Source #

Class of things that have an AxisStyle.

Minimal complete definition

axisStyle

Methods

axisStyle :: Lens' a (AxisStyle (V a)) Source #

Lens onto the AxisStyle.

axisColourMap :: Lens' a ColourMap Source #

The ColourMap is used to draw the ColourBar and render plots like HeatMap.

axisStyles :: IndexedTraversal' Int a (PlotStyle (V a)) Source #

Traversal over the PlotStyles in an AxisStyle. There are always an infinite number of PlotStyles in an AxisStyle.

Predefined styles

fadedColours :: AxisStyle V2 Source #

Theme using funColours with faded fills and thick lines.

vividColours :: AxisStyle V2 Source #

Theme using funColours with no lines on 'areaStyle.

blackAndWhite :: AxisStyle V2 Source #

Theme without any colours, useful for black and white documents.

Plot Style

data PlotStyle v Source #

Plot styles are used to style each plot in an axis. Every Axis comes with a list of plots styles (contained in the AxisStyle) which get applied the plots upon rendering.

You can either change the list of plot styles used with axisStyle:

stylishAxis = r2Axis &~ do
  axisStyle .= vividColours
  linePlot [(1,2) (3,4)] $ key "line 1"
  linePlot [(1,1) (4,2)] $ key "line 2"

change the style for individual plots when changing the plot state.

stylishAxis2 = r2Axis &~ do
  linePlot [(1,2) (3,4)] $ do
    key "line 1"
    plotColour .= green
  linePlot [(1,1) (4,2)] $ do
    key "line 2"
    plotColour .= orange

A plot style is made up of separate styles (lineStyle, markerStyle, areaStyle and textStyle) a plotColour and a plotMarker. When rendering a plot, the PlotStyles in an AxisStyle are used to style each plot. The lenses can be used to customise each style when adding the plot.

  • plotColour - the underlying colour of the plot
  • lineStyle - style used for lines (linePlot, connectingLine in a scatterPlot)
  • areaStyle - style used for any area (barPlot, piePlot, histogramPlot)
  • markerStyle - style used for markers in scatterPlot
  • plotMarker - marker used in scatterPlot
Instances
HasPlotStyle f (PlotStyle v) Source # 
Instance details

Defined in Plots.Style

(Metric v, Traversable v) => Transformable (PlotStyle v) Source # 
Instance details

Defined in Plots.Style

Methods

transform :: Transformation (V (PlotStyle v)) (N (PlotStyle v)) -> PlotStyle v -> PlotStyle v

type N (PlotStyle v) Source # 
Instance details

Defined in Plots.Style

type N (PlotStyle v) = Double
type V (PlotStyle v) Source # 
Instance details

Defined in Plots.Style

type V (PlotStyle v) = v

class HasPlotStyle f a where Source #

Class for objects that contain a PlotStyle.

Minimal complete definition

plotStyle

Methods

plotStyle :: LensLike' f a (PlotStyle (V a)) Source #

Lens onto the PlotStyle.

plotColour :: Functor f => LensLike' f a (Colour Double) Source #

The plotColour is the overall colour of the plot. This is passed to the other styles (lineStyle, markerStyle etc.) to give an overall colour for the plot.

plotColor :: Functor f => LensLike' f a (Colour Double) Source #

Alias for plotColour.

lineStyle :: Settable f => LensLike' f a (Style (V a) Double) Source #

This style is applied to any plots made up of lines only (like Path plots). This is a less general version of lineStyleFunction.

lineStyleFunction :: Functor f => LensLike' f a (Colour Double -> Style (V a) Double) Source #

A version lineStyle with access to the current plotColour when applyLineStyle is used.

markerStyle :: Settable f => LensLike' f a (Style (V a) Double) Source #

This style is applied to any markers in the plot (usually the plotMarker). This is a less general version of markerStyleFunction.

markerStyleFunction :: Functor f => LensLike' f a (Colour Double -> Style (V a) Double) Source #

A version lineStyle with access to the current plotColour when applyMarkerStyle is used.

areaStyle :: Settable f => LensLike' f a (Style (V a) Double) Source #

This style is applied to any filled areas in a plot (like Bar or Ribbon). This is a less general version of areaStyleFunction.

areaStyleFunction :: Functor f => LensLike' f a (Colour Double -> Style (V a) Double) Source #

A version areaStyle with access to the current plotColour when applyAreaStyle is used.

textStyle :: Settable f => LensLike' f a (Style (V a) Double) Source #

This style is applied to text plots. This is a less general version of textStyleFunction.

textStyleFunction :: Functor f => LensLike' f a (Colour Double -> Style (V a) Double) Source #

A version textStyle with access to the current plotColour when applyAreaStyle is used.

plotMarker :: Functor f => LensLike' f a (Diagram (V a)) Source #

This diagram is used as any markers in a plot (like Scatter). The markerStyle will be applied to this marker when the plot gets rendered.

plotStyles :: Settable f => LensLike' f a (Style (V a) Double) Source #

A traversal over all the styles (lineStyle, markerStyle, areaStyle and textStyle) of a PlotStyle. This is a less general version of plotStyleFunctions.

plotStyleFunctions :: Applicative f => LensLike' f a (Colour Double -> Style (V a) Double) Source #

A version of plotStyles with access to the plotColour.

Instances
Applicative f => HasPlotStyle f (AxisStyle v) Source # 
Instance details

Defined in Plots.Style

HasPlotStyle f (PlotStyle v) Source # 
Instance details

Defined in Plots.Style

Functor f => HasPlotStyle f (StyledPlot v) Source # 
Instance details

Defined in Plots.Types

Settable f => HasPlotStyle f (DynamicPlot v) Source # 
Instance details

Defined in Plots.Types

Settable f => HasPlotStyle f (Plot p) Source # 
Instance details

Defined in Plots.Types

Settable f => HasPlotStyle f (PlotMods v) Source # 
Instance details

Defined in Plots.Types

Settable f => HasPlotStyle f (Axis c) Source # 
Instance details

Defined in Plots.Axis

Applying Plot styles

applyLineStyle :: (InSpace v Double t, ApplyStyle t) => PlotStyle v -> t -> t Source #

Apply the lineStyle from a PlotStyle.

applyLineStyle :: (InSpace v n t, HasStyle t) => PlotStyle v -> t -> t

applyMarkerStyle :: (InSpace v Double t, ApplyStyle t) => PlotStyle v -> t -> t Source #

Apply the markerStyle from a PlotStyle.

applyMarkerStyle :: (InSpace v n t, HasStyle t) => PlotStyle v -> t -> t

applyAreaStyle :: (InSpace v Double t, ApplyStyle t) => PlotStyle v -> t -> t Source #

Apply the 'areaStyle from a PlotStyle.

applyLineStyle :: (InSpace v n t, HasStyle t) => PlotStyle v -> t -> t

applyTextStyle :: (InSpace v Double t, ApplyStyle t) => PlotStyle v -> t -> t Source #

Apply the textStyle from a PlotStyle.

applyTextStyle :: (InSpace v n t, HasStyle t) => PlotStyle v -> t -> t

Colour schemes

colours1 :: OrderedField n => [Colour n] Source #

A colourful colour set used for fadedColours.

colours2 :: OrderedField n => [Colour n] Source #

Another colour set, used for vividColours.

Marker shapes

asterisk :: OrderedField n => Int -> n -> Path V2 n Source #

Make an asterisk with n spokes, each of length l.

diamond :: (InSpace V2 n t, FromTrail t, OrderedField n) => n -> t Source #

A rotated square.

crossShape :: (InSpace V2 n t, FromTrail t, OrderedField n) => n -> t Source #

A rotated plus.

star' :: (InSpace V2 n t, FromTrail t, OrderedField n) => n -> t Source #

A filled in five sided start of size x.

plus :: (InSpace V2 n t, FromTrail t, OrderedField n) => n -> t Source #

Filled in + symbol.

lineMarkers :: OrderedField n => [Path V2 n] Source #

asterisk markers with varying numbers of prongs.

Colour maps

data ColourMap Source #

A map from a number (usually between 0 and 1) to a colour. Colour maps are part of the AxisStyle, which is used for plots like HeatMap.

Instances
Show ColourMap Source # 
Instance details

Defined in Plots.Style

Ixed ColourMap Source # 
Instance details

Defined in Plots.Style

At ColourMap Source #

Nothing == transparent

Instance details

Defined in Plots.Style

Transformable ColourMap Source # 
Instance details

Defined in Plots.Style

Methods

transform :: Transformation (V ColourMap) (N ColourMap) -> ColourMap -> ColourMap

HasNanColours ColourMap Source # 
Instance details

Defined in Plots.Style

Each ColourMap ColourMap (Colour Double) (Colour Double) Source # 
Instance details

Defined in Plots.Style

type Index ColourMap Source # 
Instance details

Defined in Plots.Style

type IxValue ColourMap Source # 
Instance details

Defined in Plots.Style

type N ColourMap Source # 
Instance details

Defined in Plots.Style

type V ColourMap Source # 
Instance details

Defined in Plots.Style

type V ColourMap = V1

cmTraverse :: IndexedTraversal' Rational ColourMap (Colour Double) Source #

Indexed traversal over the colours indexed and ordered by their position in the map.

colourList :: ColourMap -> [(Rational, Colour Double)] Source #

Return the list of colours in the [0,1] range in order. This always includes colours 0 and 1.

toStops :: ColourMap -> [GradientStop] Source #

data NanColours Source #

Colours to use when representing NaN, Infinity and -Infinity.

class HasNanColours a where Source #

Minimal complete definition

nanColours

Methods

nanColours :: Lens' a NanColours Source #

Colours to use when displaying NaN, Infinity and -Infinity.

nanColour :: Lens' a (Colour Double) Source #

Colour to use when displaying NaN.

Default is 'white.

infColour :: Lens' a (Colour Double) Source #

Colour to use when displaying Infinity.

Default is lime.

negInfColour :: Lens' a (Colour Double) Source #

Colour to use when displaying -Infinity.

Default is magenta.

Sample maps

viridis :: ColourMap Source #

The viridis colour map taken from https://bids.github.io/colormap/. This is the default colour map.

magma :: ColourMap Source #

The magma colour map taken from https://bids.github.io/colormap/.

inferno :: ColourMap Source #

The inferno colour map taken from https://bids.github.io/colormap/.

plasma :: ColourMap Source #

The plasma colour map taken from https://bids.github.io/colormap/.

greys :: ColourMap Source #

A colour map from black to white.