manim-web 0.23.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/export/SlideDeckExporter.d.ts +210 -0
- package/dist/export/SlideDeckExporter.d.ts.map +1 -0
- package/dist/export/index.d.ts +1 -0
- package/dist/export/index.d.ts.map +1 -1
- package/dist/html2canvas-DECPJJGt.js +4025 -0
- package/dist/index.d.ts +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es-BiZp4vgJ.js +5753 -0
- package/dist/index.js +3 -3
- package/dist/integrations/react.js +17 -17
- package/dist/integrations/vue.js +16 -16
- package/dist/jspdf.es.min-CvMJL6nS.js +18228 -0
- package/dist/manim-web.browser.js +5532 -3742
- package/dist/mobjects/graph/ForceDirectedLayout.d.ts +65 -0
- package/dist/mobjects/graph/ForceDirectedLayout.d.ts.map +1 -0
- package/dist/mobjects/graph/GenericGraph.d.ts +11 -0
- package/dist/mobjects/graph/GenericGraph.d.ts.map +1 -1
- package/dist/mobjects/graph/SankeyDiagram.d.ts +122 -0
- package/dist/mobjects/graph/SankeyDiagram.d.ts.map +1 -0
- package/dist/mobjects/graph/index.d.ts +4 -1
- package/dist/mobjects/graph/index.d.ts.map +1 -1
- package/dist/mobjects/graph/layoutAlgorithms.d.ts +54 -0
- package/dist/mobjects/graph/layoutAlgorithms.d.ts.map +1 -1
- package/dist/mobjects/graph/sankeyLayout.d.ts +97 -0
- package/dist/mobjects/graph/sankeyLayout.d.ts.map +1 -0
- package/dist/mobjects/graphing/BoxPlot.d.ts +99 -0
- package/dist/mobjects/graphing/BoxPlot.d.ts.map +1 -0
- package/dist/mobjects/graphing/CandlestickChart.d.ts +191 -0
- package/dist/mobjects/graphing/CandlestickChart.d.ts.map +1 -0
- package/dist/mobjects/graphing/DomainColoring.d.ts +114 -0
- package/dist/mobjects/graphing/DomainColoring.d.ts.map +1 -0
- package/dist/mobjects/graphing/FourierEpicycles.d.ts +149 -0
- package/dist/mobjects/graphing/FourierEpicycles.d.ts.map +1 -0
- package/dist/mobjects/graphing/FourierSeries.d.ts +60 -0
- package/dist/mobjects/graphing/FourierSeries.d.ts.map +1 -0
- package/dist/mobjects/graphing/Histogram.d.ts +71 -0
- package/dist/mobjects/graphing/Histogram.d.ts.map +1 -0
- package/dist/mobjects/graphing/ScatterPlot.d.ts +66 -0
- package/dist/mobjects/graphing/ScatterPlot.d.ts.map +1 -0
- package/dist/mobjects/graphing/ViolinPlot.d.ts +83 -0
- package/dist/mobjects/graphing/ViolinPlot.d.ts.map +1 -0
- package/dist/mobjects/graphing/fourier.d.ts +104 -0
- package/dist/mobjects/graphing/fourier.d.ts.map +1 -0
- package/dist/mobjects/graphing/index.d.ts +10 -0
- package/dist/mobjects/graphing/index.d.ts.map +1 -1
- package/dist/mobjects/graphing/stats.d.ts +128 -0
- package/dist/mobjects/graphing/stats.d.ts.map +1 -0
- package/dist/purify.es-MUrypqLF.js +864 -0
- package/dist/serialization/index.d.ts +2 -0
- package/dist/serialization/index.d.ts.map +1 -1
- package/dist/serialization/urlState.d.ts +127 -0
- package/dist/serialization/urlState.d.ts.map +1 -0
- package/dist/{src-BRT6RDfk.js → src-Dq6hmMfV.js} +3347 -1557
- package/dist/typeof-CcP5rTWg.js +11 -0
- package/package.json +2 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Group } from '../../core/Group';
|
|
2
|
+
import { VGroup } from '../../core/VGroup';
|
|
3
|
+
import { Dot } from '../geometry/Dot';
|
|
4
|
+
import { Axes } from './Axes';
|
|
5
|
+
/** Options for creating a ScatterPlot. */
|
|
6
|
+
export interface ScatterPlotOptions {
|
|
7
|
+
/** X coordinates of the points. */
|
|
8
|
+
x: number[];
|
|
9
|
+
/** Y coordinates of the points. Paired with x by index. */
|
|
10
|
+
y: number[];
|
|
11
|
+
/** Dot radius, or a per-point radius array for a bubble chart. Default: 0.06 */
|
|
12
|
+
sizes?: number | number[];
|
|
13
|
+
/** Dot color, or a per-point color array. Default: Manim color palette */
|
|
14
|
+
colors?: string | string[];
|
|
15
|
+
/** Fill opacity for the dots. Default: 1 */
|
|
16
|
+
fillOpacity?: number;
|
|
17
|
+
/** Stroke width for the dots. Default: 0 */
|
|
18
|
+
strokeWidth?: number;
|
|
19
|
+
/** An existing Axes to plot onto. When omitted, one is built from the data. */
|
|
20
|
+
axes?: Axes;
|
|
21
|
+
/** X-axis range override as [min, max] or [min, max, step]. */
|
|
22
|
+
xRange?: [number, number] | [number, number, number];
|
|
23
|
+
/** Y-axis range override as [min, max] or [min, max, step]. */
|
|
24
|
+
yRange?: [number, number] | [number, number, number];
|
|
25
|
+
/** Visual length of the x-axis when auto-building axes. Default: 8 */
|
|
26
|
+
xLength?: number;
|
|
27
|
+
/** Visual length of the y-axis when auto-building axes. Default: 6 */
|
|
28
|
+
yLength?: number;
|
|
29
|
+
/** Color for the axes when auto-building. Default: '#ffffff' */
|
|
30
|
+
axisColor?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* ScatterPlot - points plotted as dots on a coordinate system.
|
|
34
|
+
*
|
|
35
|
+
* Each (x, y) pair becomes a Dot. Per-point sizes and colors turn the plot
|
|
36
|
+
* into a bubble chart. When no Axes is supplied, one is built to fit the data.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* const plot = new ScatterPlot({
|
|
41
|
+
* x: [1, 2, 3, 4],
|
|
42
|
+
* y: [2, 1, 4, 3],
|
|
43
|
+
* sizes: [0.05, 0.1, 0.15, 0.2],
|
|
44
|
+
* colors: ['#ff0000', '#00ff00'],
|
|
45
|
+
* });
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare class ScatterPlot extends Group {
|
|
49
|
+
/** The coordinate system the points are plotted on. */
|
|
50
|
+
axes: Axes;
|
|
51
|
+
/** The plotted dots, one per (x, y) pair. */
|
|
52
|
+
dots: VGroup;
|
|
53
|
+
protected _x: number[];
|
|
54
|
+
protected _y: number[];
|
|
55
|
+
constructor(options: ScatterPlotOptions);
|
|
56
|
+
/** Get the coordinate system. */
|
|
57
|
+
getAxes(): Axes;
|
|
58
|
+
/** Get the group of plotted dots. */
|
|
59
|
+
getDots(): VGroup;
|
|
60
|
+
/** Get a single dot by point index, or undefined when out of range. */
|
|
61
|
+
getDot(index: number): Dot | undefined;
|
|
62
|
+
/** The number of plotted points. */
|
|
63
|
+
get numPoints(): number;
|
|
64
|
+
copy(): ScatterPlot;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=ScatterPlot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScatterPlot.d.ts","sourceRoot":"","sources":["../../../src/mobjects/graphing/ScatterPlot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAO9B,0CAA0C;AAC1C,MAAM,WAAW,kBAAkB;IACjC,mCAAmC;IACnC,CAAC,EAAE,MAAM,EAAE,CAAC;IACZ,2DAA2D;IAC3D,CAAC,EAAE,MAAM,EAAE,CAAC;IACZ,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC1B,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+EAA+E;IAC/E,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,+DAA+D;IAC/D,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACrD,+DAA+D;IAC/D,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACrD,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,WAAY,SAAQ,KAAK;IACpC,uDAAuD;IACvD,IAAI,EAAE,IAAI,CAAC;IACX,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IAEb,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC;gBAEX,OAAO,EAAE,kBAAkB;IAuDvC,iCAAiC;IACjC,OAAO,IAAI,IAAI;IAIf,qCAAqC;IACrC,OAAO,IAAI,MAAM;IAIjB,uEAAuE;IACvE,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS;IAItC,oCAAoC;IACpC,IAAI,SAAS,IAAI,MAAM,CAEtB;IAEQ,IAAI,IAAI,WAAW;CAK7B"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Group } from '../../core/Group';
|
|
2
|
+
import { Polygon } from '../geometry/Polygon';
|
|
3
|
+
import { Axes } from './Axes';
|
|
4
|
+
import { PlotOrientation } from './BoxPlot';
|
|
5
|
+
/** The sampled KDE for one violin group. */
|
|
6
|
+
export interface ViolinDensity {
|
|
7
|
+
/** Value-axis positions where the density was sampled, low to high. */
|
|
8
|
+
values: number[];
|
|
9
|
+
/** Estimated density at each value. */
|
|
10
|
+
densities: number[];
|
|
11
|
+
/** Half-width of the violin at each value, in category units. */
|
|
12
|
+
halfWidths: number[];
|
|
13
|
+
}
|
|
14
|
+
/** Options for creating a ViolinPlot. */
|
|
15
|
+
export interface ViolinPlotOptions {
|
|
16
|
+
/** One data group (number[]) or several groups (number[][]). */
|
|
17
|
+
data: number[] | number[][];
|
|
18
|
+
/** KDE bandwidth. Default: Silverman's rule of thumb per group. */
|
|
19
|
+
bandwidth?: number;
|
|
20
|
+
/** Lay violins along the x-axis ('vertical') or y-axis ('horizontal'). Default: 'vertical' */
|
|
21
|
+
orientation?: PlotOrientation;
|
|
22
|
+
/** Violin color, or a per-group color array. Default: Manim color palette */
|
|
23
|
+
colors?: string | string[];
|
|
24
|
+
/** Fill opacity for the violins. Default: 0.5 */
|
|
25
|
+
fillOpacity?: number;
|
|
26
|
+
/** Stroke width for the violin outline. Default: 2 */
|
|
27
|
+
strokeWidth?: number;
|
|
28
|
+
/** Number of KDE samples along the value axis per group. Default: 48 */
|
|
29
|
+
resolution?: number;
|
|
30
|
+
/** Maximum half-width of a violin in category units. Default: 0.4 */
|
|
31
|
+
widthScale?: number;
|
|
32
|
+
/** An existing Axes to draw onto. When omitted, one is built from the data. */
|
|
33
|
+
axes?: Axes;
|
|
34
|
+
/** Visual length of the x-axis when auto-building axes. Default: 8 */
|
|
35
|
+
xLength?: number;
|
|
36
|
+
/** Visual length of the y-axis when auto-building axes. Default: 6 */
|
|
37
|
+
yLength?: number;
|
|
38
|
+
/** Color for the axes when auto-building. Default: '#ffffff' */
|
|
39
|
+
axisColor?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* ViolinPlot - a mirrored kernel-density shape per data group.
|
|
43
|
+
*
|
|
44
|
+
* Each group estimates a Gaussian KDE over its value range and draws a shape
|
|
45
|
+
* that is symmetric about the group's category line. The widest part of the
|
|
46
|
+
* violin sits at the densest value (the mode). Groups sit side by side along
|
|
47
|
+
* the category axis.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* const violin = new ViolinPlot({
|
|
52
|
+
* data: [[1, 2, 2, 3, 3, 3, 4, 4, 5], [2, 3, 3, 4]],
|
|
53
|
+
* bandwidth: 0.5,
|
|
54
|
+
* });
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare class ViolinPlot extends Group {
|
|
58
|
+
/** The coordinate system the violins are drawn on. */
|
|
59
|
+
axes: Axes;
|
|
60
|
+
protected _groupsData: number[][];
|
|
61
|
+
protected _orientation: PlotOrientation;
|
|
62
|
+
protected _densities: ViolinDensity[];
|
|
63
|
+
protected _violins: (Polygon | null)[];
|
|
64
|
+
constructor(options: ViolinPlotOptions);
|
|
65
|
+
/** Padded value range covering every data value across all groups. */
|
|
66
|
+
private _valueRange;
|
|
67
|
+
/** Sample the KDE of one group over its value range. */
|
|
68
|
+
private _sampleDensity;
|
|
69
|
+
/** Map a (category, value) pair to a world point, respecting orientation. */
|
|
70
|
+
private _toPoint;
|
|
71
|
+
/** Build the mirrored KDE polygon for one group. */
|
|
72
|
+
private _buildViolin;
|
|
73
|
+
/** Get the coordinate system. */
|
|
74
|
+
getAxes(): Axes;
|
|
75
|
+
/** Get the sampled KDE for one group. */
|
|
76
|
+
getDensity(index: number): ViolinDensity;
|
|
77
|
+
/** Get the violin polygon for one group, or null when the group is empty. */
|
|
78
|
+
getViolin(index: number): Polygon | null;
|
|
79
|
+
/** The number of data groups. */
|
|
80
|
+
get numGroups(): number;
|
|
81
|
+
copy(): ViolinPlot;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=ViolinPlot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ViolinPlot.d.ts","sourceRoot":"","sources":["../../../src/mobjects/graphing/ViolinPlot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,WA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;gBAEhC,OAAO,EAAE,iBAAiB;IAiDtC,sEAAsE;IACtE,OAAO,CAAC,WAAW;IAKnB,wDAAwD;IACxD,OAAO,CAAC,cAAc;IAiCtB,6EAA6E;IAC7E,OAAO,CAAC,QAAQ;IAMhB,oDAAoD;IACpD,OAAO,CAAC,YAAY;IA2BpB,iCAAiC;IACjC,OAAO,IAAI,IAAI;IAIf,yCAAyC;IACzC,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa;IASxC,6EAA6E;IAC7E,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI;IAIxC,iCAAiC;IACjC,IAAI,SAAS,IAAI,MAAM,CAEtB;IAEQ,IAAI,IAAI,UAAU;CAQ5B"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { Complex } from './ComplexPlane';
|
|
2
|
+
/**
|
|
3
|
+
* A single Fourier coefficient expressed in polar form.
|
|
4
|
+
*
|
|
5
|
+
* The complex coefficient is `amplitude * e^(i * phase)`. In an epicycle
|
|
6
|
+
* drawing each coefficient is one rotating vector: `amplitude` is the circle
|
|
7
|
+
* radius, `phase` is the starting angle, and `freq` is the signed number of
|
|
8
|
+
* turns the vector makes per unit of normalized time `t`.
|
|
9
|
+
*/
|
|
10
|
+
export interface FourierCoefficient {
|
|
11
|
+
/** Signed integer frequency (…, -2, -1, 0, 1, 2, …), centered around 0. */
|
|
12
|
+
freq: number;
|
|
13
|
+
/** Non-negative magnitude |c_k| (the rotating-vector length / circle radius). */
|
|
14
|
+
amplitude: number;
|
|
15
|
+
/** Phase arg(c_k) in radians, in (-π, π]. */
|
|
16
|
+
phase: number;
|
|
17
|
+
}
|
|
18
|
+
/** Ordering strategy for the coefficient chain. */
|
|
19
|
+
export type FourierOrder = 'amplitude' | 'frequency';
|
|
20
|
+
/**
|
|
21
|
+
* Compute the discrete Fourier coefficients of a list of complex samples.
|
|
22
|
+
*
|
|
23
|
+
* Given `N` samples `f[0..N-1]` taken at equal spacing over one period, the
|
|
24
|
+
* coefficient for index `k` is:
|
|
25
|
+
*
|
|
26
|
+
* c_k = (1 / N) * Σ_n f[n] * e^(-2πi · k · n / N)
|
|
27
|
+
*
|
|
28
|
+
* The returned array has one entry per `k` (DC term first, index `k = 0`).
|
|
29
|
+
* Each entry carries a *centered* signed frequency: indices in the upper half
|
|
30
|
+
* (`k > N/2`) map to the negative frequency `k - N`. Centered frequencies make
|
|
31
|
+
* the vectors rotate in their natural slow-to-fast, alternating-direction
|
|
32
|
+
* order while still reconstructing every sample exactly (see
|
|
33
|
+
* {@link reconstructSample}).
|
|
34
|
+
*
|
|
35
|
+
* @param samples - Complex path samples, equally spaced over one period.
|
|
36
|
+
* @returns One {@link FourierCoefficient} per sample index. Empty input yields `[]`.
|
|
37
|
+
*/
|
|
38
|
+
export declare function fourierCoefficients(samples: Complex[]): FourierCoefficient[];
|
|
39
|
+
/**
|
|
40
|
+
* Evaluate the complex sum of rotating vectors at normalized time `t`.
|
|
41
|
+
*
|
|
42
|
+
* Each coefficient contributes `amplitude · e^(i · (2π · freq · t + phase))`.
|
|
43
|
+
* At `t = sampleIndex / N` this reproduces the original sample exactly, so the
|
|
44
|
+
* full coefficient set round-trips the input of {@link fourierCoefficients}.
|
|
45
|
+
*
|
|
46
|
+
* @param coefficients - Coefficients to sum (any order; order does not change the sum).
|
|
47
|
+
* @param t - Normalized time; one full period spans `t ∈ [0, 1)`.
|
|
48
|
+
* @returns The summed complex value.
|
|
49
|
+
*/
|
|
50
|
+
export declare function reconstructSample(coefficients: FourierCoefficient[], t: number): Complex;
|
|
51
|
+
/**
|
|
52
|
+
* Sum only the first `numTerms` coefficients at normalized time `t`.
|
|
53
|
+
*
|
|
54
|
+
* This is the partial reconstruction that an {@link FourierEpicycles} pen traces
|
|
55
|
+
* when it shows `numTerms` vectors: it equals the tip of the vector chain.
|
|
56
|
+
*
|
|
57
|
+
* @param coefficients - Ordered coefficients; the first `numTerms` are summed.
|
|
58
|
+
* @param t - Normalized time; one full period spans `t ∈ [0, 1)`.
|
|
59
|
+
* @param numTerms - How many leading coefficients to include. Clamped to `[0, length]`.
|
|
60
|
+
* @returns The summed complex value. `numTerms <= 0` yields `{ re: 0, im: 0 }`.
|
|
61
|
+
*/
|
|
62
|
+
export declare function partialSum(coefficients: FourierCoefficient[], t: number, numTerms: number): Complex;
|
|
63
|
+
/**
|
|
64
|
+
* Return a reordered copy of the coefficients for the vector chain.
|
|
65
|
+
*
|
|
66
|
+
* - `'amplitude'` (best approximation per term): largest amplitude first;
|
|
67
|
+
* ties broken by smaller |freq|, then by larger signed freq.
|
|
68
|
+
* - `'frequency'` (the iconic 3Blue1Brown look): `0, +1, -1, +2, -2, …`;
|
|
69
|
+
* that is, smaller |freq| first, positive before negative within a |freq|.
|
|
70
|
+
*
|
|
71
|
+
* The input array is not mutated.
|
|
72
|
+
*
|
|
73
|
+
* @param coefficients - Coefficients to order.
|
|
74
|
+
* @param order - Ordering strategy. Default `'frequency'`.
|
|
75
|
+
* @returns A new, reordered array.
|
|
76
|
+
*/
|
|
77
|
+
export declare function orderCoefficients(coefficients: FourierCoefficient[], order?: FourierOrder): FourierCoefficient[];
|
|
78
|
+
/**
|
|
79
|
+
* Options for {@link fourierSeriesApproximation}.
|
|
80
|
+
*/
|
|
81
|
+
export interface FourierSeriesApproximationOptions {
|
|
82
|
+
/** Length of one period in the function's domain. Default `2π`. */
|
|
83
|
+
period?: number;
|
|
84
|
+
/** Start of the sampled period in the domain. Default `0`. */
|
|
85
|
+
start?: number;
|
|
86
|
+
/** Number of harmonics (vectors) to keep, chosen by amplitude. Default: all. */
|
|
87
|
+
numTerms?: number;
|
|
88
|
+
/** Number of samples taken over one period. Default `256`. */
|
|
89
|
+
numSamples?: number;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Build the truncated Fourier approximation of a real periodic function.
|
|
93
|
+
*
|
|
94
|
+
* The function is sampled over one period, its discrete coefficients are
|
|
95
|
+
* computed, the `numTerms` largest are kept, and the returned function
|
|
96
|
+
* evaluates the real part of the partial sum at any `x`. With `numTerms`
|
|
97
|
+
* equal to the sample count the approximation reproduces the samples.
|
|
98
|
+
*
|
|
99
|
+
* @param func - The real periodic function `y = f(x)`.
|
|
100
|
+
* @param options - Period, sampling, and term-count options.
|
|
101
|
+
* @returns A function `x -> y` giving the truncated approximation.
|
|
102
|
+
*/
|
|
103
|
+
export declare function fourierSeriesApproximation(func: (x: number) => number, options?: FourierSeriesApproximationOptions): (x: number) => number;
|
|
104
|
+
//# sourceMappingURL=fourier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fourier.d.ts","sourceRoot":"","sources":["../../../src/mobjects/graphing/fourier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB;IACjC,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC;IACb,iFAAiF;IACjF,SAAS,EAAE,MAAM,CAAC;IAClB,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC;CACf;AAED,mDAAmD;AACnD,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,WAAW,CAAC;AAIrD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,kBAAkB,EAAE,CA+B5E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,kBAAkB,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAExF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CACxB,YAAY,EAAE,kBAAkB,EAAE,EAClC,CAAC,EAAE,MAAM,EACT,QAAQ,EAAE,MAAM,GACf,OAAO,CAaT;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,kBAAkB,EAAE,EAClC,KAAK,GAAE,YAA0B,GAChC,kBAAkB,EAAE,CAiBtB;AAED;;GAEG;AACH,MAAM,WAAW,iCAAiC;IAChD,mEAAmE;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gFAAgF;IAChF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8DAA8D;IAC9D,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,EAC3B,OAAO,GAAE,iCAAsC,GAC9C,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAgBvB"}
|
|
@@ -16,11 +16,21 @@ export { sampleColormap, valueToColor, VIRIDIS, INFERNO, COOLWARM } from './colo
|
|
|
16
16
|
export { marchingSquares, type ContourSegment } from './marchingSquares';
|
|
17
17
|
export { HeatMap, type HeatMapOptions, type ScalarField2D } from './HeatMap';
|
|
18
18
|
export { ContourPlot, type ContourPlotOptions, type ContourField } from './ContourPlot';
|
|
19
|
+
export { DomainColoring, phasePortraitColor, type DomainColoringOptions, type ComplexFunction, type BrightnessScheme, } from './DomainColoring';
|
|
19
20
|
export { ParametricFunction, type ParametricFunctionOptions } from './ParametricFunction';
|
|
20
21
|
export { VectorFieldVector, type VectorFieldVectorOptions } from './Vector';
|
|
22
|
+
export { fourierCoefficients, reconstructSample, partialSum, orderCoefficients, fourierSeriesApproximation, type FourierCoefficient, type FourierOrder, type FourierSeriesApproximationOptions, } from './fourier';
|
|
23
|
+
export { FourierEpicycles, type FourierEpicyclesOptions, type FourierPathInput, type ComplexPathFunction, } from './FourierEpicycles';
|
|
24
|
+
export { FourierSeries, type FourierSeriesOptions } from './FourierSeries';
|
|
21
25
|
export { ComplexPlane, type ComplexPlaneOptions, type Complex } from './ComplexPlane';
|
|
22
26
|
export { PolarPlane, type PolarPlaneOptions } from './ComplexPlane';
|
|
23
27
|
export { BarChart, type BarChartOptions } from './BarChart';
|
|
28
|
+
export { CandlestickChart, type CandlestickChartOptions, type OHLC } from './CandlestickChart';
|
|
24
29
|
export { PieChart, type PieChartOptions, DonutChart, type DonutChartOptions, computeSliceGeometry, type SliceGeometry, type LabelPosition, } from './PieChart';
|
|
30
|
+
export { mean, stdDev, quantile, iqr, histogramBins, kde, silvermanBandwidth, boxSummary, extent, niceAxisRange, type HistogramBin, type HistogramBinsOptions, type KdeOptions, type BoxSummary, } from './stats';
|
|
31
|
+
export { Histogram, type HistogramOptions } from './Histogram';
|
|
32
|
+
export { ScatterPlot, type ScatterPlotOptions } from './ScatterPlot';
|
|
33
|
+
export { BoxPlot, type BoxPlotOptions, type PlotOrientation } from './BoxPlot';
|
|
34
|
+
export { ViolinPlot, type ViolinPlotOptions, type ViolinDensity } from './ViolinPlot';
|
|
25
35
|
export { VectorField, ArrowVectorField, StreamLines, stepVectorField, type Integrator, type VectorFunction, type ColorFunction, type VectorFieldBaseOptions, type ArrowVectorFieldOptions, type StreamLinesOptions, type ContinuousMotionOptions, } from './VectorField';
|
|
26
36
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mobjects/graphing/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,UAAU,EACV,KAAK,iBAAiB,EACtB,YAAY,EACZ,KAAK,mBAAmB,GACzB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,IAAI,EAAE,KAAK,WAAW,EAAE,MAAM,QAAQ,CAAC;AAGhD,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAG3D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAGtF,OAAO,EAAE,KAAK,2BAA2B,EAAE,KAAK,uBAAuB,EAAE,MA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AK,UAAU,EACf,KAAK,UAAU,GAChB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAGtF,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,GAC7B,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure statistics helpers for the statistical plot suite.
|
|
3
|
+
*
|
|
4
|
+
* These functions are side-effect free and operate on plain number arrays.
|
|
5
|
+
* They are reused by Histogram, ScatterPlot, BoxPlot and ViolinPlot.
|
|
6
|
+
*
|
|
7
|
+
* Degenerate inputs never throw:
|
|
8
|
+
* - Empty data returns NaN for scalar reducers and empty results for binning.
|
|
9
|
+
* - All-equal data returns a zero inter-quartile range and a zero-width spread.
|
|
10
|
+
*/
|
|
11
|
+
/** One bin of a histogram. */
|
|
12
|
+
export interface HistogramBin {
|
|
13
|
+
/** Left edge of the bin (inclusive). */
|
|
14
|
+
x0: number;
|
|
15
|
+
/** Right edge of the bin (exclusive, except the last bin which is inclusive). */
|
|
16
|
+
x1: number;
|
|
17
|
+
/** Number of data values that fall in the bin. */
|
|
18
|
+
count: number;
|
|
19
|
+
/** Probability density: count / (total * binWidth). Area over all bins is 1. */
|
|
20
|
+
density: number;
|
|
21
|
+
}
|
|
22
|
+
/** Options for {@link histogramBins}. */
|
|
23
|
+
export interface HistogramBinsOptions {
|
|
24
|
+
/** Number of equal-width bins. Ignored when binEdges is given. Default: 10 */
|
|
25
|
+
bins?: number;
|
|
26
|
+
/** Explicit bin edges (length n+1 for n bins). Overrides bins. */
|
|
27
|
+
binEdges?: number[];
|
|
28
|
+
}
|
|
29
|
+
/** Options for {@link kde}. */
|
|
30
|
+
export interface KdeOptions {
|
|
31
|
+
/** Kernel bandwidth. Default: Silverman's rule of thumb. */
|
|
32
|
+
bandwidth?: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Arithmetic mean of the data.
|
|
36
|
+
* @returns NaN when data is empty.
|
|
37
|
+
*/
|
|
38
|
+
export declare function mean(data: number[]): number;
|
|
39
|
+
/**
|
|
40
|
+
* Standard deviation of the data.
|
|
41
|
+
* @param sample - When true, divide by n-1 (sample). Default: false (population).
|
|
42
|
+
* @returns NaN when data is empty. 0 for a single population value.
|
|
43
|
+
*/
|
|
44
|
+
export declare function stdDev(data: number[], sample?: boolean): number;
|
|
45
|
+
/**
|
|
46
|
+
* Linear-interpolated quantile (the numpy / R type-7 definition).
|
|
47
|
+
* @param data - The sample values (not required to be sorted).
|
|
48
|
+
* @param q - Quantile in [0, 1]. Values outside are clamped.
|
|
49
|
+
* @returns NaN when data is empty.
|
|
50
|
+
*/
|
|
51
|
+
export declare function quantile(data: number[], q: number): number;
|
|
52
|
+
/**
|
|
53
|
+
* Inter-quartile range: quantile(0.75) - quantile(0.25).
|
|
54
|
+
* @returns NaN when data is empty. 0 when all values are equal.
|
|
55
|
+
*/
|
|
56
|
+
export declare function iqr(data: number[]): number;
|
|
57
|
+
/**
|
|
58
|
+
* Bin raw data into a histogram.
|
|
59
|
+
*
|
|
60
|
+
* With computed edges, every value lands in a bin and the counts sum to the
|
|
61
|
+
* data length. The last bin includes its right edge. With explicit binEdges,
|
|
62
|
+
* values outside the edge range are dropped.
|
|
63
|
+
*
|
|
64
|
+
* @returns An array of bins, left to right. Empty when data is empty and no
|
|
65
|
+
* explicit edges are given.
|
|
66
|
+
*/
|
|
67
|
+
export declare function histogramBins(data: number[], options?: HistogramBinsOptions): HistogramBin[];
|
|
68
|
+
/**
|
|
69
|
+
* Smallest and largest values in an array.
|
|
70
|
+
* @returns [0, 0] when the array is empty.
|
|
71
|
+
*/
|
|
72
|
+
export declare function extent(values: number[]): [number, number];
|
|
73
|
+
/**
|
|
74
|
+
* Build a padded [min, max, step] axis range that covers [dataMin, dataMax].
|
|
75
|
+
*
|
|
76
|
+
* The range is padded by 5% on each side. Equal or reversed bounds expand to a
|
|
77
|
+
* unit-wide window so a plot axis is never zero-width. The step divides the
|
|
78
|
+
* padded span into about `divisions` ticks.
|
|
79
|
+
*
|
|
80
|
+
* @param dataMin - Smallest data value.
|
|
81
|
+
* @param dataMax - Largest data value.
|
|
82
|
+
* @param divisions - Target tick count. Default: 5
|
|
83
|
+
*/
|
|
84
|
+
export declare function niceAxisRange(dataMin: number, dataMax: number, divisions?: number): [number, number, number];
|
|
85
|
+
/**
|
|
86
|
+
* Silverman's rule-of-thumb bandwidth: 1.06 * sigma * n^(-1/5).
|
|
87
|
+
* @returns 0 when data has fewer than 2 points or zero spread.
|
|
88
|
+
*/
|
|
89
|
+
export declare function silvermanBandwidth(data: number[]): number;
|
|
90
|
+
/**
|
|
91
|
+
* Build a Gaussian kernel-density estimator for the data.
|
|
92
|
+
*
|
|
93
|
+
* @returns A function that evaluates the estimated density at a point. The
|
|
94
|
+
* estimator returns 0 everywhere when data is empty. Zero-spread data uses a
|
|
95
|
+
* tiny positive bandwidth so the estimator stays finite and never divides by
|
|
96
|
+
* zero.
|
|
97
|
+
*/
|
|
98
|
+
export declare function kde(data: number[], options?: KdeOptions): (x: number) => number;
|
|
99
|
+
/**
|
|
100
|
+
* Compute box-plot summary statistics for one group of data.
|
|
101
|
+
*
|
|
102
|
+
* The whiskers extend to the most extreme data values still inside
|
|
103
|
+
* [Q1 - factor*IQR, Q3 + factor*IQR]. Values beyond the whiskers are outliers.
|
|
104
|
+
*/
|
|
105
|
+
export interface BoxSummary {
|
|
106
|
+
/** First quartile (25th percentile). */
|
|
107
|
+
q1: number;
|
|
108
|
+
/** Median (50th percentile). */
|
|
109
|
+
median: number;
|
|
110
|
+
/** Third quartile (75th percentile). */
|
|
111
|
+
q3: number;
|
|
112
|
+
/** Inter-quartile range (Q3 - Q1). */
|
|
113
|
+
iqr: number;
|
|
114
|
+
/** Lower whisker end (smallest datum >= Q1 - factor*IQR). */
|
|
115
|
+
whiskerLow: number;
|
|
116
|
+
/** Upper whisker end (largest datum <= Q3 + factor*IQR). */
|
|
117
|
+
whiskerHigh: number;
|
|
118
|
+
/** Data values outside the whiskers. */
|
|
119
|
+
outliers: number[];
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Summarise a data group for a box plot.
|
|
123
|
+
* @param factor - Whisker length as a multiple of the IQR. Default: 1.5
|
|
124
|
+
* @returns A summary whose fields are NaN and whose outliers are empty when
|
|
125
|
+
* data is empty.
|
|
126
|
+
*/
|
|
127
|
+
export declare function boxSummary(data: number[], factor?: number): BoxSummary;
|
|
128
|
+
//# sourceMappingURL=stats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../../src/mobjects/graphing/stats.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,8BAA8B;AAC9B,MAAM,WAAW,YAAY;IAC3B,wCAAwC;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,iFAAiF;IACjF,EAAE,EAAE,MAAM,CAAC;IACX,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,gFAAgF;IAChF,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,yCAAyC;AACzC,MAAM,WAAW,oBAAoB;IACnC,8EAA8E;IAC9E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,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