dataframe-viz-1.3.1.0: Visualisation/plotting helpers for the dataframe ecosystem.
Safe HaskellNone
LanguageHaskell2010

DataFrame.Display.Terminal.Plot

Description

A plotly-express-style one-shot plotting API for terminal output.

Each chart kind has a small record spec (with sensible defaults) and a single render function. Customise plots by record-update on the spec:

bar ((mkBar Sex) { y = Just Survived }) titanic
bar ((mkBar "ocean_proximity")
      { y = Just "median_house_value", agg = Mean }) housing
Synopsis

Aggregation

data Agg Source #

Aggregation strategy for grouped/categorical plots.

Constructors

Count

Count rows per group; ignores the value column.

Sum

Sum of value column per group.

Mean

Arithmetic mean of value column per group.

Median

Median of value column per group.

Min

Minimum of value column per group.

Max

Maximum of value column per group.

Instances

Instances details
Show Agg Source # 
Instance details

Defined in DataFrame.Display.Internal.Common

Methods

showsPrec :: Int -> Agg -> ShowS #

show :: Agg -> String #

showList :: [Agg] -> ShowS #

Eq Agg Source # 
Instance details

Defined in DataFrame.Display.Internal.Common

Methods

(==) :: Agg -> Agg -> Bool #

(/=) :: Agg -> Agg -> Bool #

Bar charts

data Bar Source #

Bar-chart specification.

x is required; everything else has a default. When y is Nothing the chart counts rows per group; otherwise y is aggregated using agg.

Constructors

Bar 

Fields

  • x :: Text

    Grouping (categorical) column.

  • y :: Maybe Text

    Value column; Nothing counts rows.

  • agg :: Agg

    Aggregation applied to y. Defaults to Sum.

  • topN :: Maybe Int

    Optional cap on the number of bars (rest folded into Other).

  • title :: Maybe Text

    Chart title; auto-generated if Nothing.

  • plot :: Plot

    Granite plot configuration (size, palette, ticks, etc.).

mkBar :: Text -> Bar Source #

Smart constructor: spec with sensible defaults, given the x column.

bar :: HasCallStack => Bar -> DataFrame -> IO () Source #

Render a Bar spec to stdout.

Histograms

data Histogram Source #

Histogram specification for a numeric column.

Constructors

Histogram 

Fields

Scatter plots

data Scatter Source #

Scatter-plot specification.

Constructors

Scatter 

Fields

Line charts

data Line Source #

Line-chart specification: one x column, one or more y series.

Constructors

Line 

Fields

Pie charts

data Pie Source #

Pie-chart specification.

Constructors

Pie 

Fields

Box plots

data Box Source #

Box-plot specification across one or more numeric columns.

Constructors

Box 

Fields

Whole-frame plots

heatmap :: HasCallStack => DataFrame -> IO () Source #

Heatmap of all numeric columns in the dataframe; each numeric column becomes a column of the matrix.

correlationMatrix :: HasCallStack => DataFrame -> IO () Source #

Pearson correlation heatmap across all numeric columns.

Deprecated legacy entry points

These shims delegate to the parametrized API. They are kept for one release to ease migration; prefer the spec-based functions above for new code.

plotHistogram :: HasCallStack => Text -> DataFrame -> IO () Source #

Deprecated: use 'histogram (mkHistogram col)' instead

Use histogram with mkHistogram instead.

plotScatter :: HasCallStack => Text -> Text -> DataFrame -> IO () Source #

Deprecated: use 'scatter (mkScatter xCol yCol)' instead

Use scatter with mkScatter instead.

plotBars :: HasCallStack => Text -> DataFrame -> IO () Source #

Deprecated: use 'bar (mkBar col)' instead

Use bar with mkBar instead.

plotLines :: HasCallStack => Text -> [Text] -> DataFrame -> IO () Source #

Deprecated: use 'line (mkLine xCol yCols)' instead

Use line with mkLine instead.

plotPie :: HasCallStack => Text -> Maybe Text -> DataFrame -> IO () Source #

Deprecated: use 'pie (mkPie col)' instead

Use pie with mkPie instead.

plotBoxPlots :: HasCallStack => [Text] -> DataFrame -> IO () Source #

Deprecated: use 'box (mkBox cols)' instead

Use box with mkBox instead.

plotStackedBars :: HasCallStack => Text -> [Text] -> DataFrame -> IO () Source #

Stacked-bar plot: one bar per category, segments from the listed value columns. Kept as a direct passthrough to granite — has no spec record because no aggregation is involved (segments are summed per category).

plotHeatmap :: HasCallStack => DataFrame -> IO () Source #

Deprecated: use heatmap instead

Use heatmap instead.