@mk7s/holochart-express
Classes
| Class | Description |
|---|---|
| Table | An immutable table of named, equally long columns. Built by toTable (which every Express function calls on its data) or fromCSV. |
Interfaces
| Interface | Description |
|---|---|
| AdjacencyMatrixOptions | Options of adjacencyMatrix. |
| AnimationFrameOptions | Animation frames from data (plan E23.4). |
| AreaOptions | Options of area. |
| ArrowLikeTable | An 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. |
| ArrowLikeVector | An Arrow vector, duck-typed: get(i) and length, and toArray() when available. |
| AxisOptions | Cartesian axis options. |
| BarOptions | Options of bar: px.bar's arguments in camelCase. |
| BarPolarOptions | Options of barPolar: px.bar_polar's arguments in camelCase. |
| BoxOptions | Options of box: px.box's arguments in camelCase. |
| Chart3dOptions | Options every 3D function takes: the columns, error bars and the scene's axes. |
| ChoroplethOptions | Options 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. |
| CommonOptions | Options every Express function takes. |
| ContinuousColorOptions | Continuous color: when color is numeric, one colorscale on layout.coloraxis with a colorbar instead of one trace per value. |
| CSVOptions | Options of fromCSV. |
| DensityContourOptions | Options of densityContour: px.density_contour's arguments in camelCase. |
| DensityHeatmapOptions | Options of densityHeatmap: px.density_heatmap's arguments in camelCase. |
| DiscreteColorOptions | Discrete color grouping: one trace (and legend item) per value of color. |
| DistplotOptions | Options of distplot: create_distplot's arguments in camelCase. |
| EcdfOptions | Options of ecdf: px.ecdf's arguments in camelCase. |
| ErrorBarOptions | Error bars from columns. |
| EwmOptions | Options of ewm: pandas' Series.ewm arguments (exactly one of com, span, halflife, alpha). |
| ExpressFigure | A figure as Express builds it: plain JSON-like data, ready for createChart or newPlot. |
| ExpressFunction | An Express function: builds a figure from data, or renders it when given an element first. |
| FacetOptions | Faceting (plan E23.3): one subplot per value, in a grid. |
| FunnelAreaOptions | Options of funnelArea: px.funnel_area's arguments in camelCase. |
| FunnelOptions | Options of funnel: px.funnel's arguments in camelCase. |
| GaussianKde | A 1-D Gaussian KDE: its bandwidth and density function. |
| GeoOptions | Options every map function takes: the locations and the geo subplot. |
| GraphDataOptions | Options the graph functions share: the columns of the edge and node tables. |
| GraphFunction | A graph function: called with data it returns the figure, with an element first it renders. |
| GraphOptions | Options of graph. |
| HierarchyOptions | Options of sunburst, treemap and icicle: px's arguments in camelCase. |
| HistogramOptions | Options of histogram: px.histogram's arguments in camelCase. |
| HoverOptions | Hover and custom data. |
| ImageDataLike | ImageData or anything shaped like it: height × width RGBA pixels, row by row. |
| ImshowFunction | imshow called with an image (returns the figure) or with an element first (renders it). |
| ImshowLabels | Display names of imshow's dimensions (px's labels keys; camelCase keys work too). |
| ImshowOptions | Options of imshow: px.imshow's arguments in camelCase. |
| Line3dOptions | Options of line3d: px.line_3d's arguments in camelCase. |
| LineDashOptions | Line dash grouping. |
| LineGeoOptions | Options of lineGeo: px.line_geo's arguments in camelCase. |
| LineOptions | Options of line. |
| LinePolarOptions | Options of linePolar: px.line_polar's arguments in camelCase. |
| LowessOptions | Options of lowess: statsmodels' arguments. |
| MarginalOptions | Marginals above (marginalX) and right of (marginalY) the main plot. |
| NodeLinkInput | Node-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. |
| OlsFit | The fit of y = params[0] + params[1] · x (or y = params[0] · x without a constant). |
| ParallelCategoriesOptions | Options of parallelCategories: px.parallel_categories' arguments in camelCase. |
| ParallelCoordinatesOptions | Options of parallelCoordinates: px.parallel_coordinates' arguments in camelCase. |
| PatternOptions | Pattern grouping: one trace per value with marker.pattern.shape set (bar, histogram, timeline), drawn as a hatch fill (plan E8.10). |
| PieOptions | Options of pie: px.pie's arguments in camelCase. |
| PolarOptions | Options every polar function takes. |
| RollingOptions | Options of rolling: pandas' Series.rolling arguments. |
| Scatter3dOptions | Options of scatter3d: px.scatter_3d's arguments in camelCase. |
| ScatterGeoOptions | Options of scatterGeo: px.scatter_geo's arguments in camelCase. |
| ScatterMatrixOptions | Options of scatterMatrix: px.scatter_matrix's arguments in camelCase. |
| ScatterOptions | Options of scatter: px.scatter's arguments in camelCase. |
| ScatterPolarOptions | Options of scatterPolar: px.scatter_polar's arguments in camelCase. |
| StripOptions | Options of strip: px.strip's arguments in camelCase (as traces-stats' strip()). |
| SymbolOptions | Marker symbol grouping. |
| TimelineOptions | Options of timeline: px.timeline's arguments in camelCase. |
| TrendlineArgs | Trendline options of the functions that draw them (scatter, densityContour). |
| TrendlineOptions | trendlineOptions: plotly.py's trendline_options in camelCase. Which keys apply depends on the kind; others are rejected. |
| TrendlineResult | One OLS fit of a figure, as a row of px's get_trendline_results DataFrame. |
| ViolinOptions | Options of violin: px.violin's arguments in camelCase. |
| XYOptions | x / y columns and the orientation. |
Type Aliases
| Type Alias | Description |
|---|---|
| AggFunction | agg (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. |
| ChordOptions | Options of chord. color groups the nodes whatever its type (a chord has no colorscale). |
| ColumnRef | A 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. |
| ColumnsInput | Columns: { country: [...], pop: Float64Array }, all the same length. |
| ColumnType | What a column holds, as Express's grouping, colors and axes see it. |
| ContinuousScale | A continuous colorscale: a named scale ('Viridis'), a list of colors, or [position, color] pairs. |
| DataInput | Everything Express accepts as data: rows, columns, an Arrow-like table or a Table (e.g. from fromCSV). |
| EcdfMode | ecdfmode: 'standard' (default) counts values at or below x; 'reversed' at or above x; 'complementary' above x (1 − standard). |
| EcdfNorm | ecdfnorm: the cumulative axis as a share ('probability', default), in 'percent', or counts (null). |
| EwmFunction | The statistics ewm computes (pandas' ExponentialMovingWindow methods). |
| GraphInput | What graph reads: an edge table, or node-link data. |
| GraphMatrix | A 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 | - |
| ImshowArray | Nested 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. |
| ImshowInput | What imshow displays. |
| ImshowValue | A pixel value: numbers; booleans become 0 / 255; null, undefined and NaN are gaps. |
| MarginalKind | Marginal distribution subplots (plan E10.8). |
| RowsInput | Rows: [{ country: 'Chad', pop: 1.2e7 }, …]. Column names are the keys, in first-seen order. |
| SunburstOptions | - |
| TreemapOptions | - |
| TrendlineKind | The kinds of trendline (plotly.py's trendline_functions). |
| WindowFunction | A statistic of a window's present values, by pandas' method name, or a function of them. |
Variables
| Variable | Description |
|---|---|
| adjacencyMatrix | A 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. |
| area | A 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. |
| bar | A 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. |
| barPolar | A 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. |
| box | A box plot (px.box): one box trace per group, side by side in group mode. |
| chord | A 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. |
| choropleth | A 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). |
| data | Data helpers: data.fromCSV(text), data.toTable(rows), data.columnTypes(rows), …. |
| default | Everything as one namespace: hx.scatter(…), hx.data.fromCSV(…), hx.ff.distplot(…). |
| densityContour | A density contour plot (px.density_contour): histogram2dcontour contour lines (contours.coloring: 'none'), one trace per color group in its color. |
| densityHeatmap | A 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. |
| ecdf | An 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. |
| ff | Figure factories: ff.distplot(samples, labels, options). |
| funnel | A 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. |
| funnelArea | A 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). |
| graph | A 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'. |
| histogram | A 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. |
| icicle | An icicle chart (px.icicle): one icicle trace of adjoined rectangles cascading from the root, with the options of sunburst. |
| imshow | An 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). |
| line | A 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). |
| line3d | A 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. |
| lineGeo | Lines 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. |
| linePolar | A polar line chart (px.line_polar): one scatterpolar line per group of color / lineDash / symbol / lineGroup values, in data order; lineClose closes each line. |
| parallelCategories | Parallel 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. |
| parallelCoordinates | Parallel coordinates (px.parallel_coordinates): one parcoords trace over the numeric dimensions, lines colored by a numeric color on layout.coloraxis. |
| pie | A 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. |
| scatter | A 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). |
| scatter3d | A 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). |
| scatterGeo | Markers 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'. |
| scatterMatrix | A 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'). |
| scatterPolar | A 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. |
| strip | A 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. |
| sunburst | A 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). |
| timeline | A 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. |
| treemap | A treemap (px.treemap): one treemap trace of nested rectangles, with the options of sunburst. |
| violin | A violin plot (px.violin): one violin trace per group, scaled together (scalegroup). |
Functions
| Function | Description |
|---|---|
| columnTypes | The inferred type of every column of data, by name (see inferColumnType). |
| distplot | A 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. |
| ecdfValues | The 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. |
| ewm | An 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. |
| expanding | An expanding statistic (pandas' series.expanding(min_periods).fn()): fn of the present values up to each point. minPeriods defaults to 1. |
| fitNormal | Maximum-likelihood normal fit (scipy.stats.norm.fit): mean and standard deviation with n. |
| fromCSV | Parse 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. |
| gaussianKde | A 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. |
| getTrendlineResults | The 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 []. |
| inferColumnType | The 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). |
| isMissing | A missing value: null, undefined or NaN (pandas' NA). |
| lowess | Smooth 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. |
| normalPdf | The normal density with mean and sd at x. |
| ols | Fit 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. |
| parseCSVRecords | Split 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. |
| rolling | A 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. |
| toTable | Normalize any DataInput into a Table. |