-- 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.1.0 -- | 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
-- | How should traces be drawn? (lines or markers)
data Mode
Markers :: Mode
Lines :: Mode
-- | What kind of plot type are we building - scatter (inluding line plots)
-- or bars?
data TraceType
Scatter :: TraceType
Bar :: 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
RGBA :: Int -> Int -> Int -> Int -> Color
-- | use this RGB color for every point in the trace
RGB :: Int -> Int -> Int -> Color
-- | use a different color index for each point
ColIxs :: [Int] -> Color
-- | use a different color for each point
Cols :: [Color] -> Color
-- | Assign colors based on any categorical value
catColors :: Eq a => [a] -> Color
-- | Different types of markers
data Symbol
Circle :: Symbol
Square :: Symbol
Diamond :: Symbol
Cross :: Symbol
-- | Marker specification
data Marker
Marker :: Maybe Int -> Maybe Color -> Maybe Symbol -> Maybe Double -> Marker
[_size] :: Marker -> Maybe Int
[_markercolor] :: Marker -> Maybe Color
[_symbol] :: Marker -> Maybe Symbol
[_opacity] :: Marker -> Maybe Double
symbol :: Lens' Marker (Maybe Symbol)
size :: Lens' Marker (Maybe Int)
opacity :: Lens' Marker (Maybe Double)
markercolor :: Lens' Marker (Maybe Color)
-- | 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
ToZeroY :: Fill
ToNextY :: Fill
-- | line specification
data Line
Line :: Maybe Double -> Maybe Color -> Maybe Dash -> Line
[_linewidth] :: Line -> Maybe Double
[_linecolor] :: Line -> Maybe Color
[_dash] :: Line -> Maybe Dash
linewidth :: Lens' Line (Maybe Double)
linecolor :: Lens' Line (Maybe Color)
dash :: Lens' Line (Maybe Dash)
defLine :: Line
-- | A Trace is the component of a plot. Multiple traces can be
-- superimposed.
data Trace
Trace :: Maybe [Double] -> Maybe [Double] -> Maybe [Text] -> Maybe [Text] -> Maybe [Mode] -> Maybe Text -> Maybe [Text] -> TraceType -> Maybe Marker -> Maybe Line -> Maybe Fill -> Maybe Orientation -> Trace
-- | x values, as numbers
[_x] :: Trace -> Maybe [Double]
-- | y values, as numbers
[_y] :: Trace -> Maybe [Double]
-- | x values, as Text
[_xtext] :: Trace -> Maybe [Text]
-- | y values, as Text
[_ytext] :: Trace -> Maybe [Text]
-- | select one or two modes.
[_mode] :: Trace -> Maybe [Mode]
-- | name of this trace, for legend
[_name] :: Trace -> Maybe Text
[_text] :: Trace -> Maybe [Text]
[_tracetype] :: Trace -> TraceType
[_marker] :: Trace -> Maybe Marker
[_line] :: Trace -> Maybe Line
[_fill] :: Trace -> Maybe Fill
[_orientation] :: Trace -> Maybe Orientation
ytext :: Lens' Trace (Maybe [Text])
y :: Lens' Trace (Maybe [Double])
xtext :: Lens' Trace (Maybe [Text])
x :: Lens' Trace (Maybe [Double])
tracetype :: Lens' Trace TraceType
text :: Lens' Trace (Maybe [Text])
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)
fill :: Lens' Trace (Maybe Fill)
-- | an empty scatter plot
scatter :: Trace
-- | an empty bar plot
bars :: Trace
-- | Options for axes
data Axis
Axis :: Maybe (Double, Double) -> Maybe Text -> Maybe Bool -> Maybe Bool -> Axis
[_range] :: Axis -> Maybe (Double, Double)
[_axistitle] :: Axis -> Maybe Text
[_showgrid] :: Axis -> Maybe Bool
[_zeroline] :: Axis -> Maybe Bool
zeroline :: Lens' Axis (Maybe Bool)
showgrid :: Lens' Axis (Maybe Bool)
range :: Lens' Axis (Maybe (Double, Double))
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 the layout of the whole plot
data Layout
Layout :: Maybe Axis -> Maybe Axis -> Maybe Text -> Maybe Bool -> Maybe Int -> Maybe Int -> Maybe Barmode -> Maybe Margin -> Layout
[_xaxis] :: Layout -> Maybe Axis
[_yaxis] :: Layout -> Maybe Axis
[_title] :: Layout -> Maybe Text
[_showlegend] :: Layout -> Maybe Bool
[_height] :: Layout -> Maybe Int
[_width] :: Layout -> Maybe Int
[_barmode] :: Layout -> Maybe Barmode
[_margin] :: Layout -> Maybe Margin
yaxis :: Lens' Layout (Maybe Axis)
xaxis :: Lens' Layout (Maybe Axis)
width :: Lens' Layout (Maybe Int)
title :: Lens' Layout (Maybe Text)
showlegend :: Lens' Layout (Maybe Bool)
margin :: Lens' Layout (Maybe Margin)
height :: Lens' Layout (Maybe Int)
barmode :: Lens' Layout (Maybe Barmode)
-- | 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 Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Layout
instance GHC.Generics.Generic Graphics.Plotly.Layout
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Margin
instance GHC.Generics.Generic Graphics.Plotly.Margin
instance GHC.Show.Show Graphics.Plotly.Barmode
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Axis
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Barmode
instance GHC.Generics.Generic Graphics.Plotly.Axis
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Trace
instance GHC.Generics.Generic Graphics.Plotly.Trace
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Line
instance GHC.Generics.Generic Graphics.Plotly.Line
instance GHC.Show.Show Graphics.Plotly.Fill
instance GHC.Show.Show Graphics.Plotly.Dash
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Marker
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Dash
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Orientation
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Fill
instance GHC.Generics.Generic Graphics.Plotly.Marker
instance GHC.Show.Show Graphics.Plotly.Symbol
instance GHC.Show.Show Graphics.Plotly.TraceType
instance GHC.Show.Show Graphics.Plotly.Mode
instance Data.Aeson.Types.ToJSON.ToJSON [Graphics.Plotly.Mode]
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.TraceType
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Color
instance Data.Aeson.Types.ToJSON.ToJSON Graphics.Plotly.Symbol
-- | 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.Plotly -- | Simple histograms module Graphics.Plotly.Histogram -- | build a histogram with a given binsize histogram :: Int -> [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.Plotly