altair_recipes package

Module contents

Top-level package for altair_recipes.

altair_recipes.areaplot(data=None, x=0, y=1, color=None, stack=<StackType.auto: None>, height=600, width=800)[source]

Generate a areaplot.

Parameters:
  • data (altair.Data or pandas.DataFrame or csv or json file URL) – The data from which the statistical graphics is being generated
  • x (int, str, pandas Series or a type convertible to it.) – The column containing the data associated with the horizontal dimension
  • y (int, str, pandas Series or a type convertible to it.) – The column containing the data associated with the vertical dimension
  • color (str or int) – The column containing the data associated with the color of the mark
  • stack (StackType) – One of StackType.auto (automatic selection), StackType.true (force), StackType.false (no stacking) and StackType.normalize (for normalized stacked)
  • height (int) – The height of the chart
  • width (int) – The width of the chart
Returns:

An altair Chart.

Return type:

type altair.Chart or altair.LayerChart

altair_recipes.autocorrelation(data=None, column=0, max_lag=None, height=600, width=800)[source]

Generate an autocorrelation plot.

Parameters:
  • data (altair.Data or pandas.DataFrame or csv or json file URL) – The data from which the statistical graphics is being generated
  • column (int, str, pandas Series or a type convertible to it.) – The column containing the data to be used in the graphics
  • max_lag (int) – Maximum lag to show in the plot, defaults to number of rows in data
  • height (int) – The height of the chart
  • width (int) – The width of the chart
Returns:

An altair Chart.

Return type:

type altair.Chart or altair.LayerChart

altair_recipes.autoplot(data=None, columns=None, group_by=None, height=600, width=800)[source]

Automatically choose and produce a statistical graphics based on up to three columns of data.

Parameters:
  • data (altair.Data or pandas.DataFrame or csv or json file URL) – The data from which the statistical graphics is being generated
  • columns (collection of: int, str, pandas Series or a type convertible to it.) – The column or columns to be used in the graphics, defaults to all
  • group_by (int, str, pandas Series or a type convertible to it.) – The column to be used to group the data when in long form. When group_by is specified columns should contain a single column
  • height (int) – The height of the chart
  • width (int) – The width of the chart
Returns:

An altair Chart.

Return type:

type altair.Chart or altair.LayerChart

altair_recipes.barchart(data=None, x=0, y=1, color=False, height=600, width=800)[source]

Generate a barchart.

Parameters:
  • data (altair.Data or pandas.DataFrame or csv or json file URL) – The data from which the statistical graphics is being generated
  • x (int, str, pandas Series or a type convertible to it.) – The column containing the data associated with the horizontal dimension
  • y (int, str, pandas Series or a type convertible to it.) – The column containing the data associated with the vertical dimension
  • color (bool) – Whether to also use color to encode the same data as the x coordinate
  • height (int) – The height of the chart
  • width (int) – The width of the chart
Returns:

An altair Chart.

Return type:

type altair.Chart or altair.LayerChart

altair_recipes.boxplot(data=None, columns=None, group_by=None, color=False, height=600, width=800)[source]

Generate a boxplot.

Parameters:
  • data (altair.Data or pandas.DataFrame or csv or json file URL) – The data from which the statistical graphics is being generated
  • columns (collection of: int, str, pandas Series or a type convertible to it.) – The column or columns to be used in the graphics, defaults to all
  • group_by (int, str, pandas Series or a type convertible to it.) – The column to be used to group the data when in long form. When group_by is specified columns should contain a single column
  • color (bool) – Whether to also use color to encode the same data as the x coordinate
  • height (int) – The height of the chart
  • width (int) – The width of the chart
Returns:

An altair Chart.

Return type:

type altair.Chart or altair.LayerChart

altair_recipes.layer(*layers, **kwargs)[source]

Layer charts: a drop in replacement for altair.layer that does a deepcopy of the layers to avoid side-effects and lifts identical datasets one level down to top level.

altair_recipes.lineplot(data=None, x=0, y=1, color=None, height=600, width=800)[source]

Generate a lineplot.

Parameters:
  • data (altair.Data or pandas.DataFrame or csv or json file URL) – The data from which the statistical graphics is being generated
  • x (int, str, pandas Series or a type convertible to it.) – The column containing the data associated with the horizontal dimension
  • y (int, str, pandas Series or a type convertible to it.) – The column containing the data associated with the vertical dimension
  • color (str or int) – The column containing the data associated with the color of the mark
  • height (int) – The height of the chart
  • width (int) – The width of the chart
Returns:

An altair Chart.

Return type:

type altair.Chart or altair.LayerChart

altair_recipes.heatmap(data=None, x=0, y=1, color=2, opacity=None, aggregate='average', height=600, width=800)[source]

Generate a heatmap.

Parameters:
  • data (altair.Data or pandas.DataFrame or csv or json file URL) – The data from which the statistical graphics is being generated
  • x (int, str, pandas Series or a type convertible to it.) – The column containing the data associated with the horizontal dimension
  • y (int, str, pandas Series or a type convertible to it.) – The column containing the data associated with the vertical dimension
  • color (str or int) – The column containing the data associated with the color of the mark
  • opacity (str) –
  • column containing the data that determines opacity of the mark (The) –
  • aggregate (str) – The aggregation function to set the color of each mark, see https://altair-viz.github.io/user_guide/encoding.html#encoding-aggregates for available options
  • height (int) – The height of the chart
  • width (int) – The width of the chart
Returns:

An altair Chart.

Return type:

type altair.Chart or altair.LayerChart

altair_recipes.histogram(data=None, column=0, height=600, width=800)[source]

Generate a histogram.

Parameters:
  • data (altair.Data or pandas.DataFrame or csv or json file URL) – The data from which the statistical graphics is being generated
  • column (int, str, pandas Series or a type convertible to it.) – The column containing the data to be used in the graphics
  • height (int) – The height of the chart
  • width (int) – The width of the chart
Returns:

An altair Chart.

Return type:

type altair.Chart or altair.LayerChart

altair_recipes.layered_histogram(data=None, columns=None, group_by=None, height=600, width=800)[source]

Generate multiple overlapping histograms.

Parameters:
  • data (altair.Data or pandas.DataFrame or csv or json file URL) – The data from which the statistical graphics is being generated
  • columns (collection of: int, str, pandas Series or a type convertible to it.) – The column or columns to be used in the graphics, defaults to all
  • group_by (int, str, pandas Series or a type convertible to it.) – The column to be used to group the data when in long form. When group_by is specified columns should contain a single column
  • height (int) – The height of the chart
  • width (int) – The width of the chart
Returns:

An altair Chart.

Return type:

type altair.Chart or altair.LayerChart

altair_recipes.multiscatterplot(data=None, columns=None, group_by=None, color=None, opacity=1, tooltip=None, height=600, width=800)[source]

Generate many scatterplots.

Based on several columns, pairwise.
Parameters:
  • data (altair.Data or pandas.DataFrame or csv or json file URL) – The data from which the statistical graphics is being generated
  • columns (collection of: int, str, pandas Series or a type convertible to it.) – The column or columns to be used in the graphics, defaults to all
  • group_by (int, str, pandas Series or a type convertible to it.) – The column to be used to group the data when in long form. When group_by is specified columns should contain a single column
  • color (str or int) – The column containing the data associated with the color of the mark
  • opacity (float) – A constant value for the opacity of the mark
  • tooltip (str or int) – The column containing the data associated with the tooltip text
  • height (int) – The height of the chart
  • width (int) – The width of the chart
Returns:

An altair Chart.

Return type:

type altair.Chart or altair.LayerChart

altair_recipes.qqplot(data=None, x=0, y=1, height=600, width=800)[source]

Generate a quantile-quantile plot.

Parameters:
  • data (altair.Data or pandas.DataFrame or csv or json file URL) – The data from which the statistical graphics is being generated
  • x (int, str, pandas Series or a type convertible to it.) – The column containing the data associated with the horizontal dimension
  • y (int, str, pandas Series or a type convertible to it.) – The column containing the data associated with the vertical dimension
  • height (int) – The height of the chart
  • width (int) – The width of the chart
Returns:

An altair Chart.

Return type:

type altair.Chart or altair.LayerChart

altair_recipes.scatterplot(data=None, x=0, y=1, color=None, opacity=1, tooltip=None, height=600, width=800)[source]

Generate a scatterplot.

Parameters:
  • data (altair.Data or pandas.DataFrame or csv or json file URL) – The data from which the statistical graphics is being generated
  • x (int, str, pandas Series or a type convertible to it.) – The column containing the data associated with the horizontal dimension
  • y (int, str, pandas Series or a type convertible to it.) – The column containing the data associated with the vertical dimension
  • color (str or int) – The column containing the data associated with the color of the mark
  • opacity (float) – A constant value for the opacity of the mark
  • tooltip (str or int) – The column containing the data associated with the tooltip text
  • height (int) – The height of the chart
  • width (int) – The width of the chart
Returns:

An altair Chart.

Return type:

type altair.Chart or altair.LayerChart

altair_recipes.smoother(data=None, x=0, y=1, window=None, interquartile_area=True, height=600, width=800)[source]

Generate a smooth line plot with optional IRQ shading area.

Parameters:
  • data (altair.Data or pandas.DataFrame or csv or json file URL) – The data from which the statistical graphics is being generated
  • x (int, str, pandas Series or a type convertible to it.) – The column containing the data associated with the horizontal dimension
  • y (int, str, pandas Series or a type convertible to it.) – The column containing the data associated with the vertical dimension
  • window (int) – The size of the smoothing window
  • interquartile_area (interquartile_area: bool) – Whether to plot the IRQ as an area
  • height (int) – The height of the chart
  • width (int) – The width of the chart
Returns:

An altair Chart.

Return type:

type altair.Chart or altair.LayerChart

class altair_recipes.StackType[source]

Bases: enum.Enum

An enumeration.

auto = None
false = False
normalize = 'normalize'
true = True
altair_recipes.stripplot(data=None, columns=None, group_by=None, color=None, opacity=1, height=600, width=800)[source]

Generate a stripplot.

Parameters:
  • data (altair.Data or pandas.DataFrame or csv or json file URL) – The data from which the statistical graphics is being generated
  • columns (collection of: int, str, pandas Series or a type convertible to it.) – The column or columns to be used in the graphics, defaults to all
  • group_by (int, str, pandas Series or a type convertible to it.) – The column to be used to group the data when in long form. When group_by is specified columns should contain a single column
  • color (str or int) – The column containing the data associated with the color of the mark
  • opacity (float) – The value of the constant opacity of the mark (use to counter overlap)
  • height (int) – The height of the chart
  • width (int) – The width of the chart
Returns:

An altair Chart.

Return type:

type altair.Chart or altair.LayerChart