numbl 0.4.3 → 0.4.4

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.
@@ -1,4 +1,4 @@
1
- import type { PlotTrace, Plot3Trace, SurfTrace, ImagescTrace, PcolorTrace, ContourTrace, BarTrace, Bar3Trace, ErrorBarTrace, BoxTrace, PieTrace, HeatmapTrace, QuiverTrace, Quiver3Trace, PlotInstruction } from "./types.js";
1
+ import type { PlotTrace, Plot3Trace, PatchTrace, SurfTrace, ImagescTrace, PcolorTrace, ContourTrace, BarTrace, Bar3Trace, ErrorBarTrace, BoxTrace, PieTrace, HeatmapTrace, QuiverTrace, Quiver3Trace, PlotInstruction } from "./types.js";
2
2
  export type AxesState = {
3
3
  holdOn: boolean;
4
4
  traces: PlotTrace[];
@@ -19,6 +19,7 @@ export type AxesState = {
19
19
  quiver3Traces: Quiver3Trace[];
20
20
  areaTraces: PlotTrace[];
21
21
  areaBaseValue: number;
22
+ patchTraces: PatchTrace[];
22
23
  title?: string;
23
24
  xlabel?: string;
24
25
  ylabel?: string;
@@ -26,6 +27,9 @@ export type AxesState = {
26
27
  shading?: "faceted" | "flat" | "interp";
27
28
  legend?: string[];
28
29
  gridOn?: boolean;
30
+ /** Axes border. Undefined/true → full rectangle (numbl's default, matching
31
+ * MATLAB `box on`); false → only the left and bottom axis lines (`box off`). */
32
+ boxOn?: boolean;
29
33
  colorbar?: boolean;
30
34
  colorbarLocation?: string;
31
35
  colormap?: string;
@@ -19,6 +19,10 @@ export interface PlotTrace {
19
19
  markerEdgeColor?: [number, number, number];
20
20
  markerFaceColor?: [number, number, number];
21
21
  markerIndices?: number[];
22
+ /** Stable identity for a trace returned as a graphics handle (e.g. from
23
+ * `line`). Lets `set(h,'XData',...)` / `update_trace` find and mutate this
24
+ * exact trace in the renderer's accumulated state across `drawnow`. */
25
+ id?: number;
22
26
  }
23
27
  export interface Plot3Trace {
24
28
  x: number[];
@@ -32,6 +36,35 @@ export interface Plot3Trace {
32
36
  markerEdgeColor?: [number, number, number];
33
37
  markerFaceColor?: [number, number, number];
34
38
  markerIndices?: number[];
39
+ /** See PlotTrace.id. */
40
+ id?: number;
41
+ }
42
+ /** A patch object: one or more colored polygons sharing a single set of
43
+ * vertices. Mirrors MATLAB's Faces/Vertices model — `patch(X,Y,C)` and the
44
+ * name-value forms are all canonicalized to this shape at parse time. */
45
+ export interface PatchTrace {
46
+ /** Unique vertices: `vertices[k] = [x, y]` (2-D) or `[x, y, z]` (3-D). */
47
+ vertices: number[][];
48
+ /** Faces as 0-based vertex-index arrays — one polygon per face. */
49
+ faces: number[][];
50
+ /** Single RGB for all faces, a colormap keyword, or 'none'. */
51
+ faceColor?: [number, number, number] | "flat" | "interp" | "none";
52
+ /** Edge color (default black [0,0,0]). */
53
+ edgeColor?: [number, number, number] | "flat" | "interp" | "none";
54
+ /** Face transparency in [0,1]. */
55
+ faceAlpha?: number;
56
+ lineWidth?: number;
57
+ lineStyle?: string;
58
+ marker?: string;
59
+ markerFaceColor?: [number, number, number] | "flat" | "none";
60
+ /** Color data driving 'flat'/'interp': one entry per face (flat) or per
61
+ * vertex (interp). Each entry is a scalar (mapped through the colormap) or
62
+ * an RGB triplet. */
63
+ faceVertexCData?: (number | [number, number, number])[];
64
+ /** True when vertices carry a z-coordinate (3-D patch). */
65
+ is3D?: boolean;
66
+ /** See PlotTrace.id — lets `set(p,...)` live-update this patch. */
67
+ id?: number;
35
68
  }
36
69
  export interface SurfTrace {
37
70
  /** X coordinates: flat array of length rows*cols (column-major) */
@@ -234,6 +267,19 @@ export type PlotInstruction = {
234
267
  } | {
235
268
  type: "plot3";
236
269
  traces: Plot3Trace[];
270
+ } | {
271
+ type: "line";
272
+ traces: PlotTrace[];
273
+ } | {
274
+ type: "line3";
275
+ traces: Plot3Trace[];
276
+ } | {
277
+ type: "patch";
278
+ trace: PatchTrace;
279
+ } | {
280
+ type: "update_trace";
281
+ id: number;
282
+ props: Record<string, unknown>;
237
283
  } | {
238
284
  type: "surf";
239
285
  trace: SurfTrace;
@@ -327,6 +373,9 @@ export type PlotInstruction = {
327
373
  } | {
328
374
  type: "set_grid";
329
375
  value: boolean;
376
+ } | {
377
+ type: "set_box";
378
+ value: boolean;
330
379
  } | {
331
380
  type: "set_colorbar";
332
381
  value: string;