-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haskell bindings to Plotly.js -- -- Generate web-based plots with the Plotly.js library. For examples, see -- https://glutamate.github.io/plotlyhs/ @package plotlyhs @version 0.2.1 -- | Helper functions for defining valid JSON instances module Graphics.Plotly.Utils unLens :: String -> String dropInitial :: String -> String -> String rename :: String -> String -> String -> String jsonOptions :: Options -- | This module defines datatypes that can be used to generate -- Plotly.js plots via their JSON values. The interface encourages -- the use of lenses. Every trace on a plot is defined by a Trace -- type value, the construction of which is the central goal of this -- module. -- -- Example scatter plot of the Iris dataset: -- --
-- import Graphics.Plotly -- import Numeric.Dataset.Iris -- -- tr :: Trace -- tr = scatter & x ?~ map sepalLength iris -- & y ?~ map sepalWidth iris -- & marker ?~ (defMarker & markercolor ?~ catColors (map irisClass irisd)) -- & mode ?~ [Markers] ---- -- Horizontal bars: -- --
-- hbarData :: [(Text, Double)]
-- hbarData = [("Simon", 14.5), ("Joe", 18.9), ("Dorothy", 16.2)]
--
-- hbarsTrace :: Trace
-- hbarsTrace = bars & ytext ?~ map fst hbarData
-- & x ?~ map snd hbarData
-- & orientation ?~ Horizontal
--
--
-- see Graphics.Plotly.Lucid for helper functions that turn traces into
-- HTML.
module Graphics.Plotly.Base
-- | How should traces be drawn? (lines or markers)
data Mode
Markers :: Mode
Lines :: Mode
ModeText :: Mode
-- | What kind of plot type are we building - scatter (inluding line plots)
-- or bars?
data TraceType
Scatter :: TraceType
Scatter3D :: TraceType
Bar :: TraceType
Mesh3D :: TraceType
Pie :: TraceType
Contour :: TraceType
-- | A color specification, either as a concrete RGB/RGBA value or a color
-- per point.
data Color
-- | use this RGBA color for every point in the trace
ColRGBA :: Int -> Int -> Int -> Int -> Color
-- | use this RGB color for every point in the trace
ColRGB :: Int -> Int -> Int -> Color
-- | use a different color index for each point
ColIx :: Int -> Color
-- | Assign colors based on any categorical value
catColors :: Eq a => [a] -> ListOrElem Value
-- | Different types of markers
data Symbol
Circle :: Symbol
Square :: Symbol
Diamond :: Symbol
Cross :: Symbol
CustomSymbol :: Text -> Symbol
data ListOrElem a
List :: [a] -> ListOrElem a
All :: a -> ListOrElem a
data Sizemode
Diameter :: Sizemode
Area :: Sizemode
-- | Marker line specification
data MarkerLine
MarkerLine :: Maybe (ListOrElem Double) -> Maybe (ListOrElem Value) -> MarkerLine
[_markerlinewidth] :: MarkerLine -> Maybe (ListOrElem Double)
[_markerlinecolor] :: MarkerLine -> Maybe (ListOrElem Value)
markerlinewidth :: Lens' MarkerLine (Maybe (ListOrElem Double))
markerlinecolor :: Lens' MarkerLine (Maybe (ListOrElem Value))
-- | default marker line specification
defMarkerLine :: MarkerLine
-- | Marker specification
data Marker
Marker :: Maybe (ListOrElem Value) -> Maybe Value -> Maybe Sizemode -> Maybe (ListOrElem Value) -> Maybe (ListOrElem Value) -> Maybe (ListOrElem Symbol) -> Maybe Double -> Maybe MarkerLine -> Marker
[_size] :: Marker -> Maybe (ListOrElem Value)
[_sizeref] :: Marker -> Maybe Value
[_sizeMode] :: Marker -> Maybe Sizemode
[_markercolor] :: Marker -> Maybe (ListOrElem Value)
[_markercolors] :: Marker -> Maybe (ListOrElem Value)
[_symbol] :: Marker -> Maybe (ListOrElem Symbol)
[_opacity] :: Marker -> Maybe Double
[_markerline] :: Marker -> Maybe MarkerLine
symbol :: Lens' Marker (Maybe (ListOrElem Symbol))
sizeref :: Lens' Marker (Maybe Value)
sizeMode :: Lens' Marker (Maybe Sizemode)
size :: Lens' Marker (Maybe (ListOrElem Value))
opacity :: Lens' Marker (Maybe Double)
markerline :: Lens' Marker (Maybe MarkerLine)
markercolors :: Lens' Marker (Maybe (ListOrElem Value))
markercolor :: Lens' Marker (Maybe (ListOrElem Value))
-- | default marker specification
defMarker :: Marker
-- | Dash type specification
data Dash
Solid :: Dash
Dashdot :: Dash
Dot :: Dash
-- | Horizontal or Vertical orientation of bars
data Orientation
Horizontal :: Orientation
Vertical :: Orientation
-- | Are we filling area plots from the zero line or to the next Y value?
data Fill
FillNone :: Fill
ToZeroY :: Fill
ToNextY :: Fill
ToZeroX :: Fill
ToNextX :: Fill
ToSelf :: Fill
ToNext :: Fill
data LineShape
Linear :: LineShape
Spline :: LineShape
Hv :: LineShape
Hvh :: LineShape
Vh :: LineShape
Vhv :: LineShape
-- | line specification
data Line
Line :: Maybe Double -> Maybe Color -> Maybe LineShape -> Maybe Dash -> Line
[_linewidth] :: Line -> Maybe Double
[_linecolor] :: Line -> Maybe Color
[_lineshape] :: Line -> Maybe LineShape
[_dash] :: Line -> Maybe Dash
linewidth :: Lens' Line (Maybe Double)
lineshape :: Lens' Line (Maybe LineShape)
linecolor :: Lens' Line (Maybe Color)
dash :: Lens' Line (Maybe Dash)
defLine :: Line
data HoverElem
HoverX :: HoverElem
HoverY :: HoverElem
HoverZ :: HoverElem
HoverText :: HoverElem
HoverName :: HoverElem
data HoverInfo
HoverPlus :: [HoverElem] -> HoverInfo
HoverAll :: HoverInfo
HoverNone :: HoverInfo
HoverSkip :: HoverInfo
data HoverOn
HoverPoints :: HoverOn
HoverFills :: HoverOn
data TextPosition
TopLeft :: TextPosition
TopCenter :: TextPosition
TopRight :: TextPosition
MiddleLeft :: TextPosition
MiddleCenter :: TextPosition
MiddleRight :: TextPosition
BottomLeft :: TextPosition
BottomCenter :: TextPosition
BottomRight :: TextPosition
-- | A Trace is the component of a plot. Multiple traces can be
-- superimposed.
data Trace
Trace :: Maybe [Value] -> Maybe [Value] -> Maybe [Value] -> Maybe [Value] -> Maybe [Text] -> Maybe Value -> Maybe [Mode] -> Maybe Text -> Maybe [Text] -> Maybe TextPosition -> TraceType -> Maybe Marker -> Maybe Line -> Maybe Fill -> Maybe Orientation -> Maybe Value -> Maybe Bool -> Maybe Text -> Maybe [Value] -> Maybe HoverInfo -> Maybe (ListOrElem Text) -> Maybe [HoverOn] -> Maybe Bool -> Maybe Bool -> Maybe [Int] -> Maybe [Int] -> Maybe [Int] -> Maybe Color -> Maybe Double -> Maybe Text -> Maybe Text -> Trace
-- | x values, as numbers
[_x] :: Trace -> Maybe [Value]
-- | y values, as numbers
[_y] :: Trace -> Maybe [Value]
-- | z values, as numbers
[_z] :: Trace -> Maybe [Value]
[_values] :: Trace -> Maybe [Value]
[_labels] :: Trace -> Maybe [Text]
[_hole] :: Trace -> Maybe Value
-- | select one or two modes.
[_mode] :: Trace -> Maybe [Mode]
-- | name of this trace, for legend
[_name] :: Trace -> Maybe Text
[_text] :: Trace -> Maybe [Text]
[_textposition] :: Trace -> Maybe TextPosition
[_tracetype] :: Trace -> TraceType
[_marker] :: Trace -> Maybe Marker
[_line] :: Trace -> Maybe Line
[_fill] :: Trace -> Maybe Fill
[_orientation] :: Trace -> Maybe Orientation
[_visible] :: Trace -> Maybe Value
[_traceshowlegend] :: Trace -> Maybe Bool
[_legendgroup] :: Trace -> Maybe Text
[_customdata] :: Trace -> Maybe [Value]
[_hoverinfo] :: Trace -> Maybe HoverInfo
[_hovertext] :: Trace -> Maybe (ListOrElem Text)
[_hoveron] :: Trace -> Maybe [HoverOn]
[_connectgaps] :: Trace -> Maybe Bool
[_sort] :: Trace -> Maybe Bool
-- | i values, as ints
[_i] :: Trace -> Maybe [Int]
-- | j values, as ints
[_j] :: Trace -> Maybe [Int]
-- | k values, as ints
[_k] :: Trace -> Maybe [Int]
[_tracecolor] :: Trace -> Maybe Color
[_traceopacity] :: Trace -> Maybe Double
-- | X-axis name
[_tracexaxis] :: Trace -> Maybe Text
-- | Y-axis name
[_traceyaxis] :: Trace -> Maybe Text
z :: Lens' Trace (Maybe [Value])
y :: Lens' Trace (Maybe [Value])
x :: Lens' Trace (Maybe [Value])
visible :: Lens' Trace (Maybe Value)
values :: Lens' Trace (Maybe [Value])
traceyaxis :: Lens' Trace (Maybe Text)
tracexaxis :: Lens' Trace (Maybe Text)
tracetype :: Lens' Trace TraceType
traceshowlegend :: Lens' Trace (Maybe Bool)
traceopacity :: Lens' Trace (Maybe Double)
tracecolor :: Lens' Trace (Maybe Color)
textposition :: Lens' Trace (Maybe TextPosition)
text :: Lens' Trace (Maybe [Text])
sort :: Lens' Trace (Maybe Bool)
orientation :: Lens' Trace (Maybe Orientation)
name :: Lens' Trace (Maybe Text)
mode :: Lens' Trace (Maybe [Mode])
marker :: Lens' Trace (Maybe Marker)
line :: Lens' Trace (Maybe Line)
legendgroup :: Lens' Trace (Maybe Text)
labels :: Lens' Trace (Maybe [Text])
k :: Lens' Trace (Maybe [Int])
j :: Lens' Trace (Maybe [Int])
i :: Lens' Trace (Maybe [Int])
hovertext :: Lens' Trace (Maybe (ListOrElem Text))
hoveron :: Lens' Trace (Maybe [HoverOn])
hoverinfo :: Lens' Trace (Maybe HoverInfo)
hole :: Lens' Trace (Maybe Value)
fill :: Lens' Trace (Maybe Fill)
customdata :: Lens' Trace (Maybe [Value])
connectgaps :: Lens' Trace (Maybe Bool)
mkTrace :: TraceType -> Trace
-- | an empty scatter plot
scatter :: Trace
-- | an empty 3D scatter plot
scatter3d :: Trace
-- | an empty bar plot
bars :: Trace
-- | an empty 3D mesh plot
mesh3d :: Trace
-- | an empty 3D mesh plot
contour :: Trace
-- | an empty pie chart
pie :: Trace
data AxisType
Log :: AxisType
Date :: AxisType
Category :: AxisType
-- | Options for axes
data Axis
Axis :: Maybe (Double, Double) -> Maybe AxisType -> Maybe Text -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe [Value] -> Maybe [Text] -> Maybe (Double, Double) -> Axis
[_range] :: Axis -> Maybe (Double, Double)
[_axistype] :: Axis -> Maybe AxisType
[_axistitle] :: Axis -> Maybe Text
[_showgrid] :: Axis -> Maybe Bool
[_zeroline] :: Axis -> Maybe Bool
[_axisvisible] :: Axis -> Maybe Bool
[_tickvals] :: Axis -> Maybe [Value]
[_ticktext] :: Axis -> Maybe [Text]
[_domain] :: Axis -> Maybe (Double, Double)
zeroline :: Lens' Axis (Maybe Bool)
tickvals :: Lens' Axis (Maybe [Value])
ticktext :: Lens' Axis (Maybe [Text])
showgrid :: Lens' Axis (Maybe Bool)
range :: Lens' Axis (Maybe (Double, Double))
domain :: Lens' Axis (Maybe (Double, Double))
axisvisible :: Lens' Axis (Maybe Bool)
axistype :: Lens' Axis (Maybe AxisType)
axistitle :: Lens' Axis (Maybe Text)
defAxis :: Axis
-- | How different bar traces be superimposed? By grouping or by stacking?
data Barmode
Stack :: Barmode
Group :: Barmode
-- | Options for Margins.
data Margin
Margin :: Int -> Int -> Int -> Int -> Int -> Margin
[_marginl] :: Margin -> Int
[_marginr] :: Margin -> Int
[_marginb] :: Margin -> Int
[_margint] :: Margin -> Int
[_marginpad] :: Margin -> Int
margint :: Lens' Margin Int
marginr :: Lens' Margin Int
marginpad :: Lens' Margin Int
marginl :: Lens' Margin Int
marginb :: Lens' Margin Int
-- | some good values for margins
thinMargins :: Margin
-- | some good values for margins
titleMargins :: Margin
-- | Options for Fonts.
data Font
Font :: Maybe Text -> Maybe Double -> Maybe Color -> Font
[_fontfamily] :: Font -> Maybe Text
[_fontsize] :: Font -> Maybe Double
[_fontcolor] :: Font -> Maybe Color
fontsize :: Lens' Font (Maybe Double)
fontfamily :: Lens' Font (Maybe Text)
fontcolor :: Lens' Font (Maybe Color)
defFont :: Font
data Align
AlignLeft :: Align
AlignCenter :: Align
AlignRight :: Align
-- | Options for annotations
data Annotation
Annotation :: Maybe Bool -> Maybe Text -> Maybe Font -> Maybe Double -> Maybe Double -> Maybe Double -> Maybe Align -> Maybe Color -> Maybe Color -> Maybe Bool -> Maybe Value -> Maybe Text -> Maybe Double -> Maybe Value -> Maybe Text -> Maybe Double -> Annotation
[_annotationvisible] :: Annotation -> Maybe Bool
[_annotationtext] :: Annotation -> Maybe Text
[_annotationfont] :: Annotation -> Maybe Font
[_annotationwidth] :: Annotation -> Maybe Double
[_annotationheight] :: Annotation -> Maybe Double
[_annotationopacity] :: Annotation -> Maybe Double
[_annotationalign] :: Annotation -> Maybe Align
[_annotataonbgcolor] :: Annotation -> Maybe Color
[_annotationbordercolor] :: Annotation -> Maybe Color
[_annotationshowarrow] :: Annotation -> Maybe Bool
[_annotationx] :: Annotation -> Maybe Value
-- | "paper" or X-axis name
[_annotationxref] :: Annotation -> Maybe Text
[_annotationxshift] :: Annotation -> Maybe Double
[_annotationy] :: Annotation -> Maybe Value
-- | "paper" or Y-axis name
[_annotationyref] :: Annotation -> Maybe Text
[_annotationyshift] :: Annotation -> Maybe Double
annotationyshift :: Lens' Annotation (Maybe Double)
annotationyref :: Lens' Annotation (Maybe Text)
annotationy :: Lens' Annotation (Maybe Value)
annotationxshift :: Lens' Annotation (Maybe Double)
annotationxref :: Lens' Annotation (Maybe Text)
annotationx :: Lens' Annotation (Maybe Value)
annotationwidth :: Lens' Annotation (Maybe Double)
annotationvisible :: Lens' Annotation (Maybe Bool)
annotationtext :: Lens' Annotation (Maybe Text)
annotationshowarrow :: Lens' Annotation (Maybe Bool)
annotationopacity :: Lens' Annotation (Maybe Double)
annotationheight :: Lens' Annotation (Maybe Double)
annotationfont :: Lens' Annotation (Maybe Font)
annotationbordercolor :: Lens' Annotation (Maybe Color)
annotationalign :: Lens' Annotation (Maybe Align)
annotataonbgcolor :: Lens' Annotation (Maybe Color)
defAnnotation :: Annotation
-- | options for the layout of the whole plot
data Layout
Layout :: Maybe Axis -> Maybe Axis -> Maybe Axis -> Maybe Axis -> Maybe Axis -> Maybe Axis -> Maybe Axis -> Maybe Axis -> Maybe Axis -> Maybe Text -> Maybe Font -> Maybe Bool -> Maybe Int -> Maybe Int -> Maybe Barmode -> Maybe Margin -> Maybe Font -> Maybe [Annotation] -> Layout
[_xaxis] :: Layout -> Maybe Axis
[_xaxis2] :: Layout -> Maybe Axis
[_xaxis3] :: Layout -> Maybe Axis
[_xaxis4] :: Layout -> Maybe Axis
[_yaxis] :: Layout -> Maybe Axis
[_yaxis2] :: Layout -> Maybe Axis
[_yaxis3] :: Layout -> Maybe Axis
[_yaxis4] :: Layout -> Maybe Axis
[_zaxis] :: Layout -> Maybe Axis
[_title] :: Layout -> Maybe Text
[_titlefont] :: Layout -> Maybe Font
[_showlegend] :: Layout -> Maybe Bool
[_height] :: Layout -> Maybe Int
[_width] :: Layout -> Maybe Int
[_barmode] :: Layout -> Maybe Barmode
[_margin] :: Layout -> Maybe Margin
[_font] :: Layout -> Maybe Font
[_annotations] :: Layout -> Maybe [Annotation]
zaxis :: Lens' Layout (Maybe Axis)
yaxis4 :: Lens' Layout (Maybe Axis)
yaxis3 :: Lens' Layout (Maybe Axis)
yaxis2 :: Lens' Layout (Maybe Axis)
yaxis :: Lens' Layout (Maybe Axis)
xaxis4 :: Lens' Layout (Maybe Axis)
xaxis3 :: Lens' Layout (Maybe Axis)
xaxis2 :: Lens' Layout (Maybe Axis)
xaxis :: Lens' Layout (Maybe Axis)
width :: Lens' Layout (Maybe Int)
titlefont :: Lens' Layout (Maybe Font)
title :: Lens' Layout (Maybe Text)
showlegend :: Lens' Layout (Maybe Bool)
margin :: Lens' Layout (Maybe Margin)
height :: Lens' Layout (Maybe Int)
font :: Lens' Layout (Maybe Font)
barmode :: Lens' Layout (Maybe Barmode)
annotations :: Lens' Layout (Maybe [Annotation])
-- | a defaultlayout
defLayout :: Layout
-- | A helper record which represents the whole plot
data Plotly
Plotly :: Text -> [Trace] -> Layout -> Plotly
[_elemid] :: Plotly -> Text
[_traces] :: Plotly -> [Trace]
[_layout] :: Plotly -> Layout
traces :: Lens' Plotly [Trace]
layout :: Lens' Plotly Layout
elemid :: Lens' Plotly Text
-- | helper function for building the plot.
plotly :: Text -> [Trace] -> Plotly
instance GHC.Generics.Generic Graphics.Plotly.Base.Plotly
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Base.Plotly
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Base.Layout
instance GHC.Generics.Generic Graphics.Plotly.Base.Layout
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Base.Annotation
instance GHC.Generics.Generic Graphics.Plotly.Base.Annotation
instance GHC.Show.Show Graphics.Plotly.Base.Align
instance GHC.Generics.Generic Graphics.Plotly.Base.Align
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Base.Align
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Base.Font
instance GHC.Generics.Generic Graphics.Plotly.Base.Font
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Base.Margin
instance GHC.Generics.Generic Graphics.Plotly.Base.Margin
instance GHC.Show.Show Graphics.Plotly.Base.Barmode
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Base.Barmode
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Base.Axis
instance GHC.Generics.Generic Graphics.Plotly.Base.Axis
instance GHC.Show.Show Graphics.Plotly.Base.AxisType
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Base.AxisType
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Base.Trace
instance GHC.Generics.Generic Graphics.Plotly.Base.Trace
instance GHC.Show.Show Graphics.Plotly.Base.TextPosition
instance GHC.Generics.Generic Graphics.Plotly.Base.TextPosition
instance GHC.Show.Show Graphics.Plotly.Base.HoverOn
instance GHC.Generics.Generic Graphics.Plotly.Base.HoverOn
instance GHC.Show.Show Graphics.Plotly.Base.HoverInfo
instance GHC.Generics.Generic Graphics.Plotly.Base.HoverInfo
instance GHC.Show.Show Graphics.Plotly.Base.HoverElem
instance GHC.Generics.Generic Graphics.Plotly.Base.HoverElem
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Base.TextPosition
instance Data.Aeson.Types.ToJSON.ToJSON [Graphics.Plotly.Base.HoverOn]
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Base.HoverInfo
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Base.Line
instance GHC.Generics.Generic Graphics.Plotly.Base.Line
instance GHC.Show.Show Graphics.Plotly.Base.LineShape
instance GHC.Show.Show Graphics.Plotly.Base.Fill
instance GHC.Show.Show Graphics.Plotly.Base.Dash
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Base.LineShape
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Base.Fill
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Base.Orientation
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Base.Dash
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Base.Marker
instance GHC.Classes.Eq Graphics.Plotly.Base.Marker
instance GHC.Generics.Generic Graphics.Plotly.Base.Marker
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Base.MarkerLine
instance GHC.Classes.Eq Graphics.Plotly.Base.MarkerLine
instance GHC.Generics.Generic Graphics.Plotly.Base.MarkerLine
instance GHC.Classes.Eq Graphics.Plotly.Base.Sizemode
instance GHC.Show.Show Graphics.Plotly.Base.Sizemode
instance GHC.Classes.Eq a => GHC.Classes.Eq (Graphics.Plotly.Base.ListOrElem a)
instance GHC.Classes.Eq Graphics.Plotly.Base.Symbol
instance GHC.Show.Show Graphics.Plotly.Base.Symbol
instance GHC.Show.Show Graphics.Plotly.Base.TraceType
instance GHC.Show.Show Graphics.Plotly.Base.Mode
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Base.Sizemode
instance Data.Aeson.Types.ToJSON.ToJSON a => Data.Aeson.Types.ToJSON.ToJSON (Graphics.Plotly.Base.ListOrElem a)
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Base.Symbol
instance GHC.Classes.Eq Graphics.Plotly.Base.Color
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Base.Color
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Base.TraceType
instance Data.Aeson.Types.ToJSON.ToJSON [Graphics.Plotly.Base.Mode]
-- | Functions to build Traces from standard data. Generated traces can
-- still be customized with lenses.
module Graphics.Plotly.Simple
-- | Generate a scatterplot from pairs
scatterPlot :: (ToJSON a, ToJSON b) => [(a, b)] -> Trace
-- | Generate a line plot from pairs
linePlot :: (ToJSON a, ToJSON b) => [(a, b)] -> Trace
-- | Generate a horizontal bar chart from pairs of text and value.
hbarChart :: [(Text, Double)] -> Trace
-- | Generate a horizontal bar chart from pairs of text and value.
vbarChart :: [(Text, Double)] -> Trace
-- | Generate a fan plot with a given width in standard deviations and
-- (x,(y,sd)) data
fanPlot :: Double -> [(Double, (Double, Double))] -> Trace
-- | Plot traces to html using lucid
--
-- Example code:
--
-- -- plotHtml :: Html () -- plotHtml = toHtml $ plotly "myDiv" [trace] & layout . title ?~ "my plot" -- & layout . width ?~ 300 ---- -- where trace is a value of type Trace module Graphics.Plotly.Lucid -- | script tag to go in the header to import the plotly.js -- javascript from the official CDN plotlyCDN :: Monad m => HtmlT m () -- | Activate a plot defined by a Plotly value plotlyJS :: Monad m => Plotly -> HtmlT m () -- | Create a div for a Plotly value plotlyDiv :: Monad m => Plotly -> HtmlT m () instance Lucid.Base.ToHtml Graphics.Plotly.Base.Plotly -- | Simple histograms module Graphics.Plotly.Histogram -- | build a histogram with a given binsize histogram :: Int -> [Double] -> Trace histMany :: Int -> [(Text, [Double])] -> [Trace] goFill :: [(Int, Int)] -> [(Int, Int)] getBinMap :: Double -> Double -> [Double] -> [(Int, Int)] -- | A limited Grammar of Graphics-like interface. -- --
-- myPts :: [(Double, Double)] -- myPts = [(1,2), (1.2, 3), (1.4,3.5)] -- -- -- -- myTrace :: Trace -- myTrace = points (aes & x .~ fst -- & y .~ snd) -- myPts --module Graphics.Plotly.GoG class ToJSON a => AxisValue a data RGB a RGB :: a -> a -> a -> RGB a data RGBA a RGBA :: a -> a -> a -> a -> RGBA a class ToJSON a => IsColor a type family XVal a type family YVal a type family CVal a type family SVal a data Aes t a Aes :: (a -> XVal t) -> (a -> YVal t) -> Maybe (a -> CVal t) -> Maybe (a -> SVal t) -> Aes t a [_x] :: Aes t a -> a -> XVal t [_y] :: Aes t a -> a -> YVal t [_color] :: Aes t a -> Maybe (a -> CVal t) [_size] :: Aes t a -> Maybe (a -> SVal t) aes :: Aes ((), (), (), ()) a setx :: AxisValue v => Aes (vx, vy, vc, vs) a -> (a -> v) -> Aes (v, vy, vc, vs) a x :: AxisValue v => Lens (Aes (vx, vy, vc, vs) a) (Aes (v, vy, vc, vs) a) (a -> vx) (a -> v) sety :: AxisValue v => Aes (vx, vy, vc, vs) a -> (a -> v) -> Aes (vx, v, vc, vs) a y :: AxisValue v => Lens (Aes (vx, vy, vc, vs) a) (Aes (vx, v, vc, vs) a) (a -> vy) (a -> v) setcol :: IsColor v => Aes (vx, vy, vc, vs) a -> Maybe (a -> v) -> Aes (vx, vy, v, vs) a color :: IsColor v => Lens (Aes (vx, vy, vc, vs) a) (Aes (vx, vy, v, vs) a) (Maybe (a -> vc)) (Maybe (a -> v)) setsize :: (AxisValue v, Num v) => Aes (vx, vy, vc, vs) a -> Maybe (a -> v) -> Aes (vx, vy, vc, v) a size :: (AxisValue v, Num v) => Lens (Aes (vx, vy, vc, vs) a) (Aes (vx, vy, vc, v) a) (Maybe (a -> vs)) (Maybe (a -> v)) points :: (AxisValue (XVal t), AxisValue (YVal t), ToJSON (CVal t), ToJSON (SVal t)) => Aes t a -> [a] -> Trace line :: (AxisValue (XVal t), AxisValue (YVal t)) => Aes t a -> [a] -> Trace hbars :: (AxisValue (XVal t), AxisValue (YVal t)) => Aes t a -> [a] -> Trace instance Graphics.Plotly.GoG.IsColor GHC.Types.Int instance Graphics.Plotly.GoG.IsColor (Graphics.Plotly.GoG.RGB GHC.Types.Int) instance Graphics.Plotly.GoG.IsColor (Graphics.Plotly.GoG.RGB GHC.Types.Double) instance Graphics.Plotly.GoG.IsColor (Graphics.Plotly.GoG.RGBA GHC.Types.Int) instance Graphics.Plotly.GoG.IsColor (Graphics.Plotly.GoG.RGBA GHC.Types.Double) instance Data.Aeson.Types.ToJSON.ToJSON (Graphics.Plotly.GoG.RGBA GHC.Types.Int) instance Data.Aeson.Types.ToJSON.ToJSON (Graphics.Plotly.GoG.RGBA GHC.Types.Double) instance Data.Aeson.Types.ToJSON.ToJSON (Graphics.Plotly.GoG.RGB GHC.Types.Int) instance Data.Aeson.Types.ToJSON.ToJSON (Graphics.Plotly.GoG.RGB GHC.Types.Double) instance Graphics.Plotly.GoG.AxisValue GHC.Types.Double instance Graphics.Plotly.GoG.AxisValue GHC.Types.Float instance Graphics.Plotly.GoG.AxisValue Data.Text.Internal.Text instance Graphics.Plotly.GoG.AxisValue GHC.Base.String instance Graphics.Plotly.GoG.AxisValue GHC.Types.Int instance Graphics.Plotly.GoG.AxisValue Data.Time.Calendar.Days.Day -- | Plot traces to html using blaze-html -- -- Example code: -- --
-- plotHtml :: Html () -- plotHtml = toHtml $ plotly "myDiv" [trace] & layout . title ?~ "my plot" -- & layout . width ?~ 300 ---- -- where trace is a value of type Trace module Graphics.Plotly.Blaze -- | script tag to go in the header to import the plotly.js -- javascript from the official CDN plotlyCDN :: Html -- | Activate a plot defined by a Plotly value plotlyJS :: Plotly -> Html -- | Create a div for a Plotly value plotlyDiv :: Plotly -> Html instance Text.Blaze.ToMarkup Graphics.Plotly.Base.Plotly -- | Re-exports the Simple interface, the grammar of grpahics interface and -- parts of the base interface. module Graphics.Plotly -- | Marker line specification data MarkerLine MarkerLine :: Maybe (ListOrElem Double) -> Maybe (ListOrElem Value) -> MarkerLine [_markerlinewidth] :: MarkerLine -> Maybe (ListOrElem Double) [_markerlinecolor] :: MarkerLine -> Maybe (ListOrElem Value) data Sizemode Diameter :: Sizemode Area :: Sizemode data ListOrElem a List :: [a] -> ListOrElem a All :: a -> ListOrElem a -- | Different types of markers data Symbol Circle :: Symbol Square :: Symbol Diamond :: Symbol Cross :: Symbol CustomSymbol :: Text -> Symbol -- | A color specification, either as a concrete RGB/RGBA value or a color -- per point. data Color -- | use this RGBA color for every point in the trace ColRGBA :: Int -> Int -> Int -> Int -> Color -- | use this RGB color for every point in the trace ColRGB :: Int -> Int -> Int -> Color -- | use a different color index for each point ColIx :: Int -> Color -- | What kind of plot type are we building - scatter (inluding line plots) -- or bars? data TraceType Scatter :: TraceType Scatter3D :: TraceType Bar :: TraceType Mesh3D :: TraceType Pie :: TraceType Contour :: TraceType -- | How should traces be drawn? (lines or markers) data Mode Markers :: Mode Lines :: Mode ModeText :: Mode -- | Assign colors based on any categorical value catColors :: Eq a => [a] -> ListOrElem Value -- | Marker specification data Marker Marker :: Maybe (ListOrElem Value) -> Maybe Value -> Maybe Sizemode -> Maybe (ListOrElem Value) -> Maybe (ListOrElem Value) -> Maybe (ListOrElem Symbol) -> Maybe Double -> Maybe MarkerLine -> Marker markerlinecolor :: Lens' MarkerLine (Maybe (ListOrElem Value)) markerlinewidth :: Lens' MarkerLine (Maybe (ListOrElem Double)) -- | default marker line specification defMarkerLine :: MarkerLine -- | line specification data Line Line :: Maybe Double -> Maybe Color -> Maybe LineShape -> Maybe Dash -> Line [_linewidth] :: Line -> Maybe Double [_linecolor] :: Line -> Maybe Color [_lineshape] :: Line -> Maybe LineShape [_dash] :: Line -> Maybe Dash data LineShape Linear :: LineShape Spline :: LineShape Hv :: LineShape Hvh :: LineShape Vh :: LineShape Vhv :: LineShape -- | Are we filling area plots from the zero line or to the next Y value? data Fill FillNone :: Fill ToZeroY :: Fill ToNextY :: Fill ToZeroX :: Fill ToNextX :: Fill ToSelf :: Fill ToNext :: Fill -- | Horizontal or Vertical orientation of bars data Orientation Horizontal :: Orientation Vertical :: Orientation -- | Dash type specification data Dash Solid :: Dash Dashdot :: Dash Dot :: Dash markercolor :: Lens' Marker (Maybe (ListOrElem Value)) markercolors :: Lens' Marker (Maybe (ListOrElem Value)) markerline :: Lens' Marker (Maybe MarkerLine) opacity :: Lens' Marker (Maybe Double) sizeMode :: Lens' Marker (Maybe Sizemode) sizeref :: Lens' Marker (Maybe Value) symbol :: Lens' Marker (Maybe (ListOrElem Symbol)) -- | default marker specification defMarker :: Marker -- | A Trace is the component of a plot. Multiple traces can be -- superimposed. data Trace Trace :: Maybe [Value] -> Maybe [Value] -> Maybe [Value] -> Maybe [Value] -> Maybe [Text] -> Maybe Value -> Maybe [Mode] -> Maybe Text -> Maybe [Text] -> Maybe TextPosition -> TraceType -> Maybe Marker -> Maybe Line -> Maybe Fill -> Maybe Orientation -> Maybe Value -> Maybe Bool -> Maybe Text -> Maybe [Value] -> Maybe HoverInfo -> Maybe (ListOrElem Text) -> Maybe [HoverOn] -> Maybe Bool -> Maybe Bool -> Maybe [Int] -> Maybe [Int] -> Maybe [Int] -> Maybe Color -> Maybe Double -> Maybe Text -> Maybe Text -> Trace data TextPosition TopLeft :: TextPosition TopCenter :: TextPosition TopRight :: TextPosition MiddleLeft :: TextPosition MiddleCenter :: TextPosition MiddleRight :: TextPosition BottomLeft :: TextPosition BottomCenter :: TextPosition BottomRight :: TextPosition data HoverOn HoverPoints :: HoverOn HoverFills :: HoverOn data HoverInfo HoverPlus :: [HoverElem] -> HoverInfo HoverAll :: HoverInfo HoverNone :: HoverInfo HoverSkip :: HoverInfo data HoverElem HoverX :: HoverElem HoverY :: HoverElem HoverZ :: HoverElem HoverText :: HoverElem HoverName :: HoverElem dash :: Lens' Line (Maybe Dash) linecolor :: Lens' Line (Maybe Color) lineshape :: Lens' Line (Maybe LineShape) linewidth :: Lens' Line (Maybe Double) defLine :: Line -- | Options for axes data Axis Axis :: Maybe (Double, Double) -> Maybe AxisType -> Maybe Text -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe [Value] -> Maybe [Text] -> Maybe (Double, Double) -> Axis [_range] :: Axis -> Maybe (Double, Double) [_axistype] :: Axis -> Maybe AxisType [_axistitle] :: Axis -> Maybe Text [_showgrid] :: Axis -> Maybe Bool [_zeroline] :: Axis -> Maybe Bool [_axisvisible] :: Axis -> Maybe Bool [_tickvals] :: Axis -> Maybe [Value] [_ticktext] :: Axis -> Maybe [Text] [_domain] :: Axis -> Maybe (Double, Double) data AxisType Log :: AxisType Date :: AxisType Category :: AxisType connectgaps :: Lens' Trace (Maybe Bool) customdata :: Lens' Trace (Maybe [Value]) fill :: Lens' Trace (Maybe Fill) hole :: Lens' Trace (Maybe Value) hoverinfo :: Lens' Trace (Maybe HoverInfo) hoveron :: Lens' Trace (Maybe [HoverOn]) hovertext :: Lens' Trace (Maybe (ListOrElem Text)) i :: Lens' Trace (Maybe [Int]) j :: Lens' Trace (Maybe [Int]) k :: Lens' Trace (Maybe [Int]) labels :: Lens' Trace (Maybe [Text]) legendgroup :: Lens' Trace (Maybe Text) marker :: Lens' Trace (Maybe Marker) mode :: Lens' Trace (Maybe [Mode]) name :: Lens' Trace (Maybe Text) orientation :: Lens' Trace (Maybe Orientation) sort :: Lens' Trace (Maybe Bool) text :: Lens' Trace (Maybe [Text]) textposition :: Lens' Trace (Maybe TextPosition) tracecolor :: Lens' Trace (Maybe Color) traceopacity :: Lens' Trace (Maybe Double) traceshowlegend :: Lens' Trace (Maybe Bool) tracetype :: Lens' Trace TraceType tracexaxis :: Lens' Trace (Maybe Text) traceyaxis :: Lens' Trace (Maybe Text) values :: Lens' Trace (Maybe [Value]) visible :: Lens' Trace (Maybe Value) z :: Lens' Trace (Maybe [Value]) mkTrace :: TraceType -> Trace -- | an empty scatter plot scatter :: Trace -- | an empty 3D scatter plot scatter3d :: Trace -- | an empty bar plot bars :: Trace -- | an empty 3D mesh plot mesh3d :: Trace -- | an empty 3D mesh plot contour :: Trace -- | an empty pie chart pie :: Trace -- | Options for Margins. data Margin Margin :: Int -> Int -> Int -> Int -> Int -> Margin [_marginl] :: Margin -> Int [_marginr] :: Margin -> Int [_marginb] :: Margin -> Int [_margint] :: Margin -> Int [_marginpad] :: Margin -> Int -- | How different bar traces be superimposed? By grouping or by stacking? data Barmode Stack :: Barmode Group :: Barmode axistitle :: Lens' Axis (Maybe Text) axistype :: Lens' Axis (Maybe AxisType) axisvisible :: Lens' Axis (Maybe Bool) domain :: Lens' Axis (Maybe (Double, Double)) range :: Lens' Axis (Maybe (Double, Double)) showgrid :: Lens' Axis (Maybe Bool) ticktext :: Lens' Axis (Maybe [Text]) tickvals :: Lens' Axis (Maybe [Value]) zeroline :: Lens' Axis (Maybe Bool) defAxis :: Axis -- | Options for Fonts. data Font Font :: Maybe Text -> Maybe Double -> Maybe Color -> Font [_fontfamily] :: Font -> Maybe Text [_fontsize] :: Font -> Maybe Double [_fontcolor] :: Font -> Maybe Color marginb :: Lens' Margin Int marginl :: Lens' Margin Int marginpad :: Lens' Margin Int marginr :: Lens' Margin Int margint :: Lens' Margin Int -- | some good values for margins thinMargins :: Margin -- | some good values for margins titleMargins :: Margin -- | Options for annotations data Annotation Annotation :: Maybe Bool -> Maybe Text -> Maybe Font -> Maybe Double -> Maybe Double -> Maybe Double -> Maybe Align -> Maybe Color -> Maybe Color -> Maybe Bool -> Maybe Value -> Maybe Text -> Maybe Double -> Maybe Value -> Maybe Text -> Maybe Double -> Annotation [_annotationvisible] :: Annotation -> Maybe Bool [_annotationtext] :: Annotation -> Maybe Text [_annotationfont] :: Annotation -> Maybe Font [_annotationwidth] :: Annotation -> Maybe Double [_annotationheight] :: Annotation -> Maybe Double [_annotationopacity] :: Annotation -> Maybe Double [_annotationalign] :: Annotation -> Maybe Align [_annotataonbgcolor] :: Annotation -> Maybe Color [_annotationbordercolor] :: Annotation -> Maybe Color [_annotationshowarrow] :: Annotation -> Maybe Bool [_annotationx] :: Annotation -> Maybe Value -- | "paper" or X-axis name [_annotationxref] :: Annotation -> Maybe Text [_annotationxshift] :: Annotation -> Maybe Double [_annotationy] :: Annotation -> Maybe Value -- | "paper" or Y-axis name [_annotationyref] :: Annotation -> Maybe Text [_annotationyshift] :: Annotation -> Maybe Double data Align AlignLeft :: Align AlignCenter :: Align AlignRight :: Align fontcolor :: Lens' Font (Maybe Color) fontfamily :: Lens' Font (Maybe Text) fontsize :: Lens' Font (Maybe Double) defFont :: Font -- | options for the layout of the whole plot data Layout Layout :: Maybe Axis -> Maybe Axis -> Maybe Axis -> Maybe Axis -> Maybe Axis -> Maybe Axis -> Maybe Axis -> Maybe Axis -> Maybe Axis -> Maybe Text -> Maybe Font -> Maybe Bool -> Maybe Int -> Maybe Int -> Maybe Barmode -> Maybe Margin -> Maybe Font -> Maybe [Annotation] -> Layout [_xaxis] :: Layout -> Maybe Axis [_xaxis2] :: Layout -> Maybe Axis [_xaxis3] :: Layout -> Maybe Axis [_xaxis4] :: Layout -> Maybe Axis [_yaxis] :: Layout -> Maybe Axis [_yaxis2] :: Layout -> Maybe Axis [_yaxis3] :: Layout -> Maybe Axis [_yaxis4] :: Layout -> Maybe Axis [_zaxis] :: Layout -> Maybe Axis [_title] :: Layout -> Maybe Text [_titlefont] :: Layout -> Maybe Font [_showlegend] :: Layout -> Maybe Bool [_height] :: Layout -> Maybe Int [_width] :: Layout -> Maybe Int [_barmode] :: Layout -> Maybe Barmode [_margin] :: Layout -> Maybe Margin [_font] :: Layout -> Maybe Font [_annotations] :: Layout -> Maybe [Annotation] annotataonbgcolor :: Lens' Annotation (Maybe Color) annotationalign :: Lens' Annotation (Maybe Align) annotationbordercolor :: Lens' Annotation (Maybe Color) annotationfont :: Lens' Annotation (Maybe Font) annotationheight :: Lens' Annotation (Maybe Double) annotationopacity :: Lens' Annotation (Maybe Double) annotationshowarrow :: Lens' Annotation (Maybe Bool) annotationtext :: Lens' Annotation (Maybe Text) annotationvisible :: Lens' Annotation (Maybe Bool) annotationwidth :: Lens' Annotation (Maybe Double) annotationx :: Lens' Annotation (Maybe Value) annotationxref :: Lens' Annotation (Maybe Text) annotationxshift :: Lens' Annotation (Maybe Double) annotationy :: Lens' Annotation (Maybe Value) annotationyref :: Lens' Annotation (Maybe Text) annotationyshift :: Lens' Annotation (Maybe Double) defAnnotation :: Annotation -- | A helper record which represents the whole plot data Plotly Plotly :: Text -> [Trace] -> Layout -> Plotly [_elemid] :: Plotly -> Text [_traces] :: Plotly -> [Trace] [_layout] :: Plotly -> Layout annotations :: Lens' Layout (Maybe [Annotation]) barmode :: Lens' Layout (Maybe Barmode) font :: Lens' Layout (Maybe Font) height :: Lens' Layout (Maybe Int) margin :: Lens' Layout (Maybe Margin) showlegend :: Lens' Layout (Maybe Bool) title :: Lens' Layout (Maybe Text) titlefont :: Lens' Layout (Maybe Font) width :: Lens' Layout (Maybe Int) xaxis :: Lens' Layout (Maybe Axis) xaxis2 :: Lens' Layout (Maybe Axis) xaxis3 :: Lens' Layout (Maybe Axis) xaxis4 :: Lens' Layout (Maybe Axis) yaxis :: Lens' Layout (Maybe Axis) yaxis2 :: Lens' Layout (Maybe Axis) yaxis3 :: Lens' Layout (Maybe Axis) yaxis4 :: Lens' Layout (Maybe Axis) zaxis :: Lens' Layout (Maybe Axis) -- | a defaultlayout defLayout :: Layout elemid :: Lens' Plotly Text layout :: Lens' Plotly Layout traces :: Lens' Plotly [Trace] -- | helper function for building the plot. plotly :: Text -> [Trace] -> Plotly