Plotting

The plotting interface is fluent, meaning that the graphical content of the plot is configured by a chain of method calls. Steps along this chain (including the Hist itself) are PlottingChain objects and the last one is Plotable1d or Plotable2d.

class histbook.vega.PlottingChain(source, item)

Mix-in for Hist (as the first in a plotting chain) and Channels in a plotting chain.

area(axis=None, profile=None, error=False, normalized=False, width=None, height=None, title=None, config=None, xscale=None, yscale=None, colorscale=None, shapescale=None)

Display bins in axis (if not the only axis) as areas on the horizontal axis.

Parameters:
  • axis (None, Axis, algebraic expression (lambda or string), or index position (integer)) – the axis to overlay; if None (default), use the only axis in this Hist
  • profile (None, profile, algebraic expression (lambda or string) or index position (integer)) – if None (default), display bin counts; otherwise, display profile means (and errors on the mean)
  • error (bool) – if True, overlay error bars
  • normalized (bool) – if True, normalize the histogram
  • height, title, config, xscale, yscale, colorscale, shapescale (width,) – graphical directives to pass to Vega-Lite
Returns:

Return type:

Plotable1d

bar(axis=None, profile=None, error=False, normalized=False, width=None, height=None, title=None, config=None, xscale=None, yscale=None, colorscale=None, shapescale=None)

Display bins in axis (if not the only axis) as bars on the horizontal axis.

Parameters:
  • axis (None, Axis, algebraic expression (lambda or string), or index position (integer)) – the axis to overlay; if None (default), use the only axis in this Hist
  • profile (None, profile, algebraic expression (lambda or string) or index position (integer)) – if None (default), display bin counts; otherwise, display profile means (and errors on the mean)
  • error (bool) – if True, overlay error bars
  • normalized (bool) – if True, normalize the histogram
  • height, title, config, xscale, yscale, colorscale, shapescale (width,) – graphical directives to pass to Vega-Lite
Returns:

Return type:

Plotable1d

below(axis)

Display bins in axis next to each other vertically.

Parameters:axis (Axis, algebraic expression (lambda or string), or index position (integer)) – the axis to overlay
Returns:
Return type:PlottingChain
beside(axis)

Display bins in axis next to each other horizontally.

Parameters:axis (Axis, algebraic expression (lambda or string), or index position (integer)) – the axis to overlay
Returns:
Return type:PlottingChain
heatmap(xaxis=None, yaxis=None, profile=None, width=None, height=None, title=None, config=None, xscale=None, yscale=None, colorscale=None)

Display bins in xaxis and yaxis (if not the only two axes) as a heatmap.

Parameters:
  • xaxis (None, Axis, algebraic expression (lambda or string), or index position (integer)) – the horizontal axis to overlay; if None (default), use the first of the only two axes in this Hist
  • yaxis (None, Axis, algebraic expression (lambda or string), or index position (integer)) – the vertical axis to overlay; if None (default), use the second of the only two axes in this Hist
  • profile (None, profile, algebraic expression (lambda or string) or index position (integer)) – if None (default), display bin counts; otherwise, display profile means (and errors on the mean)
  • height, title, config, xscale, yscale, colorscale (width,) – graphical directives to pass to Vega-Lite
Returns:

Return type:

Plotable2d

line(axis=None, profile=None, error=False, normalized=False, width=None, height=None, title=None, config=None, xscale=None, yscale=None, colorscale=None, shapescale=None)

Display bins in axis (if not the only axis) as lines on the horizontal axis.

Parameters:
  • axis (None, Axis, algebraic expression (lambda or string), or index position (integer)) – the axis to overlay; if None (default), use the only axis in this Hist
  • profile (None, profile, algebraic expression (lambda or string) or index position (integer)) – if None (default), display bin counts; otherwise, display profile means (and errors on the mean)
  • error (bool) – if True, overlay error bars
  • normalized (bool) – if True, normalize the histogram
  • height, title, config, xscale, yscale, colorscale, shapescale (width,) – graphical directives to pass to Vega-Lite
Returns:

Return type:

Plotable1d

marker(axis=None, profile=None, error=True, normalized=False, width=None, height=None, title=None, config=None, xscale=None, yscale=None, colorscale=None, shapescale=None)

Display bins in axis (if not the only axis) as markers on the horizontal axis.

Parameters:
  • axis (None, Axis, algebraic expression (lambda or string), or index position (integer)) – the axis to overlay; if None (default), use the only axis in this Hist
  • profile (None, profile, algebraic expression (lambda or string) or index position (integer)) – if None (default), display bin counts; otherwise, display profile means (and errors on the mean)
  • error (bool) – if True, overlay error bars
  • normalized (bool) – if True, normalize the histogram
  • height, title, config, xscale, yscale, colorscale, shapescale (width,) – graphical directives to pass to Vega-Lite
Returns:

Return type:

Plotable1d

overlay(axis)

Display bins in axis overlaid on each other in different colors.

Parameters:axis (Axis, algebraic expression (lambda or string), or index position (integer)) – the axis to overlay
Returns:
Return type:PlottingChain
stack(axis, order=None)

Display bins in axis stacked on one another in an area plot.

Parameters:
  • axis (Axis, algebraic expression (lambda or string), or index position (integer)) – the axis to overlay
  • order (iterable of strings) – stacking order of bins
Returns:

Return type:

PlottingChain

step(axis=None, profile=None, error=False, normalized=False, width=None, height=None, title=None, config=None, xscale=None, yscale=None, colorscale=None, shapescale=None)

Display bins in axis (if not the only axis) as steps on the horizontal axis.

Parameters:
  • axis (None, Axis, algebraic expression (lambda or string), or index position (integer)) – the axis to overlay; if None (default), use the only axis in this Hist
  • profile (None, profile, algebraic expression (lambda or string) or index position (integer)) – if None (default), display bin counts; otherwise, display profile means (and errors on the mean)
  • error (bool) – if True, overlay error bars
  • normalized (bool) – if True, normalize the histogram
  • height, title, config, xscale, yscale, colorscale, shapescale (width,) – graphical directives to pass to Vega-Lite
Returns:

Return type:

Plotable1d

class histbook.vega.Plotable1d(source, item)

Mix-in for Channels and Combinations that can be plotted.

altair(validate=True)

Return an altair.Chart of this plot using the Altair library.

ipyvega()

Draw this plot inline in a Jupyter notebook (not lab) using the vega library.

to(fcn)

Call fcn on the Vega-Lite JSON for this plot.

vegalite()

Return the Vega-Lite JSON for this plot.

vegascope(canvas=None)

Draw this plot in a (possibly remote) browser using the VegaScope library.

class histbook.vega.Plotable2d(source, item)

Mix-in for Channels and Combinations that can be plotted.

altair(validate=True)

Return an altair.Chart of this plot using the Altair library.

ipyvega()

Draw this plot inline in a Jupyter notebook (not lab) using the vega library.

to(fcn)

Call fcn on the Vega-Lite JSON for this plot.

vegalite()

Return the Vega-Lite JSON for this plot.

vegascope(canvas=None)

Draw this plot in a (possibly remote) browser using the VegaScope library.

Inheritance diagram of histbook.vega.overlay, histbook.vega.beside, histbook.vega.below, histbook.vega.grid
class histbook.vega.Combination(plotables, types, opts)

Abstract class for Plotable1ds that have been combined as an overlay or side-by-side plots.

altair(validate=True)

Return an altair.Chart of this plot using the Altair library.

ipyvega()

Draw this plot inline in a Jupyter notebook (not lab) using the vega library.

to(fcn)

Call fcn on the Vega-Lite JSON for this plot.

vegascope(canvas=None)

Draw this plot in a (possibly remote) browser using the VegaScope library.

class histbook.vega.overlay(*plotables, **opts)

Plotable1d overlaying two or more independently produced Plotable1ds.

altair(validate=True)

Return an altair.Chart of this plot using the Altair library.

ipyvega()

Draw this plot inline in a Jupyter notebook (not lab) using the vega library.

to(fcn)

Call fcn on the Vega-Lite JSON for this plot.

vegascope(canvas=None)

Draw this plot in a (possibly remote) browser using the VegaScope library.

class histbook.vega.beside(*plotables, **opts)

Plotable1d displaying two or more independently produced Plotable1ds beside each other horizontally.

altair(validate=True)

Return an altair.Chart of this plot using the Altair library.

ipyvega()

Draw this plot inline in a Jupyter notebook (not lab) using the vega library.

to(fcn)

Call fcn on the Vega-Lite JSON for this plot.

vegascope(canvas=None)

Draw this plot in a (possibly remote) browser using the VegaScope library.

class histbook.vega.below(*plotables, **opts)

Plotable1d displaying two or more independently produced Plotable1ds below each other vertically.

altair(validate=True)

Return an altair.Chart of this plot using the Altair library.

ipyvega()

Draw this plot inline in a Jupyter notebook (not lab) using the vega library.

to(fcn)

Call fcn on the Vega-Lite JSON for this plot.

vegascope(canvas=None)

Draw this plot in a (possibly remote) browser using the VegaScope library.

class histbook.vega.grid(numcol, *plotables, **opts)

Plotable1d displaying two or more independently produced Plotable1ds in a rectangular grid of numcol columns.

altair(validate=True)

Return an altair.Chart of this plot using the Altair library.

ipyvega()

Draw this plot inline in a Jupyter notebook (not lab) using the vega library.

to(fcn)

Call fcn on the Vega-Lite JSON for this plot.

vegascope(canvas=None)

Draw this plot in a (possibly remote) browser using the VegaScope library.