Skip to content

@mk7s/holochart-express ​

Classes ​

ClassDescription
TableAn immutable table of named, equally long columns. Built by toTable (which every Express function calls on its data) or fromCSV.

Interfaces ​

InterfaceDescription
AdjacencyMatrixOptionsOptions of adjacencyMatrix.
AnimationFrameOptionsAnimation frames from data (plan E23.4).
AreaOptionsOptions of area.
ArrowLikeTableAn Apache Arrow table, duck-typed (apache-arrow's Table fits): its row count, its schema's field names and a column by name. Express never imports Arrow itself.
ArrowLikeVectorAn Arrow vector, duck-typed: get(i) and length, and toArray() when available.
AxisOptionsCartesian axis options.
BarOptionsOptions of bar: px.bar's arguments in camelCase.
BarPolarOptionsOptions of barPolar: px.bar_polar's arguments in camelCase.
BoxOptionsOptions of box: px.box's arguments in camelCase.
Chart3dOptionsOptions every 3D function takes: the columns, error bars and the scene's axes.
ChoroplethOptionsOptions of choropleth: px.choropleth's arguments in camelCase. color is the column of the regions' values: numeric values map to the colorscale, others to one color per value.
CommonOptionsOptions every Express function takes.
ContinuousColorOptionsContinuous color: when color is numeric, one colorscale on layout.coloraxis with a colorbar instead of one trace per value.
CSVOptionsOptions of fromCSV.
DensityContourOptionsOptions of densityContour: px.density_contour's arguments in camelCase.
DensityHeatmapOptionsOptions of densityHeatmap: px.density_heatmap's arguments in camelCase.
DiscreteColorOptionsDiscrete color grouping: one trace (and legend item) per value of color.
DistplotOptionsOptions of distplot: create_distplot's arguments in camelCase.
EcdfOptionsOptions of ecdf: px.ecdf's arguments in camelCase.
ErrorBarOptionsError bars from columns.
EwmOptionsOptions of ewm: pandas' Series.ewm arguments (exactly one of com, span, halflife, alpha).
ExpressFigureA figure as Express builds it: plain JSON-like data, ready for createChart or newPlot.
ExpressFunctionAn Express function: builds a figure from data, or renders it when given an element first.
FacetOptionsFaceting (plan E23.3): one subplot per value, in a grid.
FunnelAreaOptionsOptions of funnelArea: px.funnel_area's arguments in camelCase.
FunnelOptionsOptions of funnel: px.funnel's arguments in camelCase.
GaussianKdeA 1-D Gaussian KDE: its bandwidth and density function.
GeoOptionsOptions every map function takes: the locations and the geo subplot.
GraphDataOptionsOptions the graph functions share: the columns of the edge and node tables.
GraphFunctionA graph function: called with data it returns the figure, with an element first it renders.
GraphOptionsOptions of graph.
HierarchyOptionsOptions of sunburst, treemap and icicle: px's arguments in camelCase.
HistogramOptionsOptions of histogram: px.histogram's arguments in camelCase.
HoverOptionsHover and custom data.
ImageDataLikeImageData or anything shaped like it: height × width RGBA pixels, row by row.
ImshowFunctionimshow called with an image (returns the figure) or with an element first (renders it).
ImshowLabelsDisplay names of imshow's dimensions (px's labels keys; camelCase keys work too).
ImshowOptionsOptions of imshow: px.imshow's arguments in camelCase.
Line3dOptionsOptions of line3d: px.line_3d's arguments in camelCase.
LineDashOptionsLine dash grouping.
LineGeoOptionsOptions of lineGeo: px.line_geo's arguments in camelCase.
LineOptionsOptions of line.
LinePolarOptionsOptions of linePolar: px.line_polar's arguments in camelCase.
LowessOptionsOptions of lowess: statsmodels' arguments.
MarginalOptionsMarginals above (marginalX) and right of (marginalY) the main plot.
NodeLinkInputNode-link data: the node and link containers of a graph trace, with links as node indices. It is what the adapters of @mk7s/holochart-traces-graph return (fromNodeLink, fromDot, fromEdgeList, fromAdjacencyMatrix). Its arrays are read as columns: node.label, node.group (the default color), node.x / node.y, node.value, link.value (the default weight) and link.label are used without being named, and directed is the default of the option.
OlsFitThe fit of y = params[0] + params[1] · x (or y = params[0] · x without a constant).
ParallelCategoriesOptionsOptions of parallelCategories: px.parallel_categories' arguments in camelCase.
ParallelCoordinatesOptionsOptions of parallelCoordinates: px.parallel_coordinates' arguments in camelCase.
PatternOptionsPattern grouping: one trace per value with marker.pattern.shape set (bar, histogram, timeline), drawn as a hatch fill (plan E8.10).
PieOptionsOptions of pie: px.pie's arguments in camelCase.
PolarOptionsOptions every polar function takes.
RollingOptionsOptions of rolling: pandas' Series.rolling arguments.
Scatter3dOptionsOptions of scatter3d: px.scatter_3d's arguments in camelCase.
ScatterGeoOptionsOptions of scatterGeo: px.scatter_geo's arguments in camelCase.
ScatterMatrixOptionsOptions of scatterMatrix: px.scatter_matrix's arguments in camelCase.
ScatterOptionsOptions of scatter: px.scatter's arguments in camelCase.
ScatterPolarOptionsOptions of scatterPolar: px.scatter_polar's arguments in camelCase.
StripOptionsOptions of strip: px.strip's arguments in camelCase (as traces-stats' strip()).
SymbolOptionsMarker symbol grouping.
TimelineOptionsOptions of timeline: px.timeline's arguments in camelCase.
TrendlineArgsTrendline options of the functions that draw them (scatter, densityContour).
TrendlineOptionstrendlineOptions: plotly.py's trendline_options in camelCase. Which keys apply depends on the kind; others are rejected.
TrendlineResultOne OLS fit of a figure, as a row of px's get_trendline_results DataFrame.
ViolinOptionsOptions of violin: px.violin's arguments in camelCase.
XYOptionsx / y columns and the orientation.

Type Aliases ​

Type AliasDescription
AggFunctionagg (a Holochart extension, plan E23.5): how bar, line and area aggregate the rows of a group that share a position — 'sum', 'avg', 'count', 'min', 'max', 'median', or a function of the present values.
ChordOptionsOptions of chord. color groups the nodes whatever its type (a chord has no colorscale).
ColumnRefA column: its name in the data, or the values themselves (an array as long as the data, as px allows). An array gets the option's name as its column name (x, color, …) in labels and hover text.
ColumnsInputColumns: { country: [...], pop: Float64Array }, all the same length.
ColumnTypeWhat a column holds, as Express's grouping, colors and axes see it.
ContinuousScaleA continuous colorscale: a named scale ('Viridis'), a list of colors, or [position, color] pairs.
DataInputEverything Express accepts as data: rows, columns, an Arrow-like table or a Table (e.g. from fromCSV).
EcdfModeecdfmode: 'standard' (default) counts values at or below x; 'reversed' at or above x; 'complementary' above x (1 − standard).
EcdfNormecdfnorm: the cumulative axis as a share ('probability', default), in 'percent', or counts (null).
EwmFunctionThe statistics ewm computes (pandas' ExponentialMovingWindow methods).
GraphInputWhat graph reads: an edge table, or node-link data.
GraphMatrixA square matrix: matrix[i][j] is the weight of the link from node i to node j. Its nodes have no table: node options are arrays with one value per row (label: ['A', 'B', 'C']), or columns of a nodes table whose rows are in the order of the matrix.
IcicleOptions-
ImshowArrayNested arrays in numpy's row-major layout: [row][col], [row][col][channel], or with leading dimensions for facetCol / animationFrame. Any level may be a typed array.
ImshowInputWhat imshow displays.
ImshowValueA pixel value: numbers; booleans become 0 / 255; null, undefined and NaN are gaps.
MarginalKindMarginal distribution subplots (plan E10.8).
RowsInputRows: [{ country: 'Chad', pop: 1.2e7 }, …]. Column names are the keys, in first-seen order.
SunburstOptions-
TreemapOptions-
TrendlineKindThe kinds of trendline (plotly.py's trendline_functions).
WindowFunctionA statistic of a window's present values, by pandas' method name, or a function of them.

Variables ​

VariableDescription
adjacencyMatrixA graph as a matrix (backlog G8): one heatmap trace on coloraxis, a row and a column per node, each cell the summed weight (or the number) of the links between the two, with square cells, the first node at the top and the labels on both axes. order sorts rows and columns so that clusters show as blocks on the diagonal. It reads where a node-link drawing is a hairball, and needs only the heatmap trace, which the full bundle has.
areaA stacked area chart (px.area): one scatter trace per group, stacked with stackgroup: '1' and filled to the previous one; groupnorm stacks to fractions or percents.
barA bar chart (px.bar): one bar trace per group of color / pattern values, per facet and per frame, stacked (barmode: 'relative') by default. A numeric color is a colorscale instead.
barPolarA polar bar chart (px.bar_polar), such as a wind rose: one barpolar trace per color / pattern group, the groups' bars stacked at each angle.
boxA box plot (px.box): one box trace per group, side by side in group mode.
chordA chord diagram: one chord trace, the nodes as arcs of a ring and the links as ribbons, from an edge table (with the options of graph that are about data) or from a square matrix (matrix[i][j]: the flow from node i to node j) with label as an array. color groups the nodes: the nodes of a group sit together, share a color and a legend item.
choroplethA choropleth map (px.choropleth): the regions locations name, colored by color — a numeric column through a colorscale on coloraxis (one choropleth trace), any other column with one color and legend item per value (one trace each).
dataData helpers: data.fromCSV(text), data.toTable(rows), data.columnTypes(rows), ….
defaultEverything as one namespace: hx.scatter(…), hx.data.fromCSV(…), hx.ff.distplot(…).
densityContourA density contour plot (px.density_contour): histogram2dcontour contour lines (contours.coloring: 'none'), one trace per color group in its color.
densityHeatmapA density heatmap (px.density_heatmap): a histogram2d per facet / frame counting the rows in each x-y bin (or aggregating z), colored on layout.coloraxis. Marginals share its axes.
ecdfAn ECDF plot (px.ecdf, plan E10.7): per group, a scatter step line (line.shape: 'hv') through the sorted values of x (or y for a horizontal one) and the share of rows at or below each. y (x when horizontal) optionally weights the rows. ecdfnorm and ecdfmode as in px; the cumulative axis starts at zero.
ffFigure factories: ff.distplot(samples, labels, options).
funnelA funnel chart (px.funnel): one funnel trace per color group — stages on the category axis (y when the values are x), each bar as wide as its value, stacked across groups (funnelmode: 'stack') — per facet and per frame.
funnelAreaA funnel area chart (px.funnel_area): one funnelarea trace, a stage per names value sized by values, colored from the colorway (or color / colorDiscreteMap, always discrete).
graphA network graph: one graph trace of the nodes and links of an edge table (source, target, weight), with an optional node table (nodes, matched by id) for labels, colors, sizes, symbols, positions and hover text. color groups the nodes (one color and legend item per value), or maps a numeric column through a colorscale on coloraxis; size takes a column or 'degree'; directed draws arrowheads; arrangement picks the layout, with its options under the trace's own name (force, layered, tree, arc, hive). Drawing the figure needs the graph package: import '@mk7s/holochart/graph'.
histogramA histogram (px.histogram): one histogram trace per group, sharing bins (bingroup), stacked by default. With both x and y, y is summed per x bin (histfunc: 'sum'). marginal draws the same values' distribution above it.
icicleAn icicle chart (px.icicle): one icicle trace of adjoined rectangles cascading from the root, with the options of sunburst.
imshowAn image or a matrix (px.imshow). A 2D array becomes a heatmap on layout.coloraxis (colorscale from the template, zmin / zmax from the data); an RGB / RGBA array ([row][col][channel]) or ImageData becomes an image trace, drawn from a PNG data URI by default. Rows run down from the top (origin: 'upper') and pixels are square (aspect: 'equal'). A third or fourth dimension can be spread over facets (facetCol) or animation frames (animationFrame).
lineA line chart (px.line): one scatter trace (mode: 'lines') per group of color / lineDash / symbol / lineGroup values, in data order (sort the data by x first).
line3dA 3D line chart (px.line_3d): one scatter3d line per group of color / lineDash / symbol / lineGroup values, in data order, on one scene; markers adds markers at the points.
lineGeoLines on a map (px.line_geo): one scattergeo line per group of color / lineDash / symbol / lineGroup values, in data order, each segment along the great circle between its points; markers adds markers at the points.
linePolarA polar line chart (px.line_polar): one scatterpolar line per group of color / lineDash / symbol / lineGroup values, in data order; lineClose closes each line.
parallelCategoriesParallel categories (px.parallel_categories): one parcats trace over the categorical dimensions (default: columns with at most 50 distinct values), ribbons colored by a numeric color on layout.coloraxis.
parallelCoordinatesParallel coordinates (px.parallel_coordinates): one parcoords trace over the numeric dimensions, lines colored by a numeric color on layout.coloraxis.
pieA pie chart (px.pie): one pie trace (per facet) with labels from names and values; color colors the sectors, from the colorway or colorDiscreteMap (or a colorscale when numeric); hole makes a donut.
scatterA scatter plot (px.scatter): one scatter trace (mode: 'markers') per group of color / symbol values, per facet and per frame. A numeric color is a colorscale on coloraxis instead; size scales marker areas; marginalX / marginalY add distributions above / right; trendline adds a fitted line per group ('ols', 'lowess', 'rolling', 'ewm', 'expanding'), with OLS fits in getTrendlineResults(figure).
scatter3dA 3D scatter plot (px.scatter_3d): one scatter3d trace (mode: 'markers') per group of color / symbol values and per frame, on one scene. A numeric color is a colorscale on coloraxis instead; size scales marker areas. Rendering needs the 3D traces registered (the @mk7s/holochart bundle, or register(...traces3d) from @mk7s/holochart-traces-3d).
scatterGeoMarkers on a map (px.scatter_geo): one scattergeo trace (mode: 'markers') per group of color / symbol values, per facet and per frame, at lat / lon or at the places locations name. A numeric color is a colorscale on coloraxis instead; size scales marker areas. Drawing the figure needs the geo package: import '@mk7s/holochart/geo'.
scatterMatrixA scatter plot matrix (px.scatter_matrix): one splom trace per color / symbol group over the dimensions (default: every numeric column not used for color, symbol, size or hover name), without the diagonal; box and lasso selections highlight across cells (dragmode: 'select').
scatterPolarA polar scatter plot (px.scatter_polar): one scatterpolar trace (mode: 'markers') per group of color / symbol values and per frame, at radius r and angle theta.
stripA strip plot (px.strip): every observation as a jittered point at its category — box traces with boxpoints: 'all' and an invisible box, one per group. The same figure as traces-stats' strip(), with Express's data, facets and animation.
sunburstA sunburst chart (px.sunburst): one sunburst trace, from names / parents / ids / values columns or built from path (with branchvalues: 'total'); color colors the sectors, through layout.coloraxis when numeric (values-weighted means on inner nodes), else from the colorway or colorDiscreteMap ('(?)' for nodes whose rows differ).
timelineA timeline / Gantt chart (px.timeline): horizontal bars from xStart to xEnd per row of y, on a date x axis (barmode: 'overlay'). Unlike Holochart's timeline() helper in traces-basic, the rows keep Plotly's bottom-up order, as in px.
treemapA treemap (px.treemap): one treemap trace of nested rectangles, with the options of sunburst.
violinA violin plot (px.violin): one violin trace per group, scaled together (scalegroup).

Functions ​

FunctionDescription
columnTypesThe inferred type of every column of data, by name (see inferColumnType).
distplotA distribution plot, like plotly.py's ff.create_distplot(hist_data, group_labels): for each sample set, a histogram (histnorm: 'probability density', bins of binSize from its smallest to largest sample, opacity: 0.7), a curve (Gaussian KDE with Scott's rule, or a fitted normal) on the same axes, and a rug (line-ns-open markers) in a strip below; barmode: 'overlay', the legend in reverse order. Differences from plotly.py: colors default to the template's colorway instead of category10. With an element first, renders it and resolves with the chart.
ecdfValuesThe ECDF of one group, as px computes it: rows sorted by their base value (descending for 'reversed'), the running sum of the weights (1 per row without a weight column), subtracted from the total for 'complementary', and divided by the total for 'probability' (× 100 for 'percent'). Rows with a missing base value are skipped; missing weights count as 0.
ewmAn exponentially weighted statistic (pandas' series.ewm(…).mean() / .sum() / .var() / .std(), a port of pandas' ewm and ewmcov loops). With adjust (default) the mean at t is Σ (1 − α)^i x_{t−i} / Σ (1 − α)^i over present values; missing values keep the previous result and, unless ignoreNa, still age the weights. var and std are bias-corrected.
expandingAn expanding statistic (pandas' series.expanding(min_periods).fn()): fn of the present values up to each point. minPeriods defaults to 1.
fitNormalMaximum-likelihood normal fit (scipy.stats.norm.fit): mean and standard deviation with n.
fromCSVParse CSV text (RFC 4180) into a Table, like pandas' read_csv: the first record names the columns; columns whose non-empty fields are all numbers become numbers; empty fields are missing (null). Dates stay ISO strings, which Express reads as dates. Records shorter than the header are padded with missing values.
gaussianKdeA Gaussian kernel density estimate with Scott's rule, identical to scipy's gaussian_kde(samples) in one dimension: the kernel variance is the samples' variance (with n − 1) times n^(−2/5), and the density at x is the mean of the kernels' densities.
getTrendlineResultsThe OLS fits of a figure built with trendline: 'ols' (plotly.py's px.get_trendline_results(fig)): one result per trendline trace, with the group it was fit on and statsmodels-like results (params, rsquared, bse, pvalues, …). Pass the figure an Express function returned, or the chart it rendered (await hx.scatter(el, …)). The results are kept beside the figure object, not in it, so they do not survive chartToJSON, structuredClone or a copy of the figure (as plotly.py keeps them on the Python figure only); other kinds of trendline, and figures without one, give [].
inferColumnTypeThe type of a column of values, as px decides from pandas dtypes: numeric when every present value is a number (or bigint), date when every present value is a Date or an ISO-8601 date string (2024-03-01, 2024-03-01 12:30, …), else categorical (strings, booleans, mixes, and columns with no present value). Missing values (null, undefined, NaN) are ignored; numeric strings are categories, as in pandas (fromCSV parses numbers first).
isMissingA missing value: null, undefined or NaN (pandas' NA).
lowessSmooth y against x: the fitted value at each point, in the order of the input. Pairs with a non-finite value are dropped first (statsmodels' missing='drop'; their fitted values are NaN). Each point's neighbourhood is the ⌊frac · n⌋ nearest points (at least 2); a weighted least-squares line through them with tricube weights (1 − (d / dmax)³)³ gives the fitted value, and each of it further passes reweights the points by the bisquare of their residuals over six times the median absolute residual.
normalPdfThe normal density with mean and sd at x.
olsFit y on x by least squares. Pairs with a non-finite value are dropped (statsmodels' missing='drop'). Degenerate designs follow statsmodels' pseudo-inverse: a constant non-zero x with addConstant is taken as the constant column itself (add_constant's has_constant='skip': one coefficient, the mean of y over x), and an all-zero regressor gets a zero slope.
parseCSVRecordsSplit RFC 4180 text into records of fields: fields are separated by the delimiter and records by CRLF, LF or CR; a field in double quotes may contain delimiters, line breaks and "" (one quote). A final line break does not start another record. A byte-order mark is dropped.
rollingA rolling statistic (pandas' series.rolling(window, min_periods, center, win_type).fn()): for each point, fn of the present values in its window. times (ms) are the index for a time-span window and must be sorted.
toTableNormalize any DataInput into a Table.

Released under the MIT License.