runmat-runtime 0.4.5

Core runtime for RunMat with builtins, BLAS/LAPACK integration, and execution APIs
Documentation
{
  "title": "mesh",
  "category": "plotting",
  "keywords": [
    "mesh",
    "wireframe plot",
    "wireframe surface",
    "matlab mesh",
    "3-D grid visualization"
  ],
  "summary": "Create wireframe surface plots for grids, height fields, and MATLAB `mesh` style visualization.",
  "hero_image": "https://web.runmatstatic.com/builtin-image/runmat-matlab-plot-mesh-hyperbolic-paraboloid.webp",
  "gpu_support": {
    "elementwise": false,
    "reduction": false,
    "precisions": [
      "single",
      "double"
    ],
    "broadcasting": "none",
    "notes": "`mesh` reuses the shared surface pipeline with wireframe-oriented rendering semantics."
  },
  "fusion": {
    "elementwise": false,
    "reduction": false,
    "max_inputs": 3,
    "constants": "inline"
  },
  "requires_feature": null,
  "tested": {
    "unit": "builtins::plotting::mesh::tests"
  },
  "description": "`mesh` creates wireframe surface plots from vector axes or meshgrid-style coordinates plus a height grid. In RunMat it shares the same surface/object infrastructure as `surf`, but presents the data as a wireframe-style surface rather than a shaded filled surface, matching MATLAB `mesh` expectations.",
  "behaviors": [
    "`mesh(Z)` uses implicit axes, while `mesh(X, Y, Z)` accepts vector axes or meshgrid-style coordinate matrices.",
    "The builtin returns a surface handle, so mesh plots can still be inspected through the graphics-object system.",
    "`mesh` is the wireframe-oriented companion to `surf`; for combined wireframe plus contour overlays, use `meshc`.",
    "RunMat uses the shared surface pipeline for mesh rendering, so view, z-axis labeling, and subplot-local state behave consistently across the surface family.",
    "GPU-backed rendering is preferred when the plotting device can consume exported buffers directly."
  ],
  "examples": [
    {
      "description": "Create a wireframe mesh from a height field",
      "input": "[X, Y] = meshgrid(linspace(-2, 2, 60), linspace(-2, 2, 60));\nZ = sin(X.^2 + Y.^2);\nmesh(X, Y, Z);"
    },
    {
      "description": "Compare wireframe presentation with subplot-local state",
      "input": "subplot(1, 2, 1);\n[X, Y] = meshgrid(linspace(-2, 2, 40), linspace(-2, 2, 40));\nZ = cos(X) .* sin(Y);\nmesh(X, Y, Z);\nview(3);\nsubplot(1, 2, 2);\nsurf(X, Y, Z);\nview(3);"
    },
    {
      "description": "Inspect the returned surface handle from mesh",
      "input": "[X, Y] = meshgrid(1:20, 1:20);\nZ = X + Y;\nh = mesh(X, Y, Z);\nget(h, 'Type')",
      "output": "ans =\n    'surface'"
    },
    {
      "description": "Saddle surface showing grid structure",
      "input": "[X, Y] = meshgrid(linspace(-3, 3, 60), linspace(-3, 3, 60));\nZ = X.^2 - Y.^2;\n\nmesh(X, Y, Z);\ncolormap('jet');\ncolorbar;\ntitle('Hyperbolic Paraboloid');\nxlabel('x');\nylabel('y');\nzlabel('z = x^2 - y^2');\nview(40, 30);",
      "image_webp": "https://web.runmatstatic.com/builtin-image/runmat-matlab-plot-mesh-hyperbolic-paraboloid.webp"
    }
  ],
  "faqs": [
    {
      "question": "Can I get a filled surface instead of wireframe?",
      "answer": "That's what `surf` is for. `mesh` draws only the grid lines with transparent faces, while `surf` fills the faces with colormap-derived colors. If you want the wireframe look but with partial fill, there's no built-in blend — use `surf` with a low alpha or switch to `mesh` and accept the wireframe."
    },
    {
      "question": "How do I combine a mesh with contour lines underneath?",
      "answer": "Use `meshc` instead of `mesh`. It draws the same wireframe surface but projects contour lines onto the base plane automatically.\n\n```matlab\n[X, Y] = meshgrid(linspace(-2, 2, 50));\nZ = sin(X.^2 + Y.^2);\nmeshc(X, Y, Z);\n```"
    },
    {
      "question": "Can I control transparency on a mesh plot?",
      "answer": "Mesh plots don't have filled faces to make transparent — the faces are already open. If you need a semi-transparent surface, use `surf` and set the `FaceAlpha` property on the returned handle. The wireframe edges on `mesh` are always fully opaque."
    }
  ],
  "links": [
    {
      "label": "surf",
      "url": "./surf"
    },
    {
      "label": "meshc",
      "url": "./meshc"
    },
    {
      "label": "view",
      "url": "./view"
    },
    {
      "label": "zlabel",
      "url": "./zlabel"
    },
    {
      "label": "colormap",
      "url": "./colormap"
    },
    {
      "label": "Choosing the right plot type",
      "url": "/docs/plotting/choosing-the-right-plot-type"
    },
    {
      "label": "Styling plots and axes",
      "url": "/docs/plotting/styling-plots-and-axes"
    },
    {
      "label": "Plot replay and export",
      "url": "/docs/plotting/plot-replay-and-export"
    },
    {
      "label": "Complete plotting guide",
      "url": "/blog/matlab-plotting-guide"
    }
  ],
  "source": {
    "label": "`crates/runmat-runtime/src/builtins/plotting/ops/mesh.rs`",
    "url": "https://github.com/runmat-org/runmat/blob/main/crates/runmat-runtime/src/builtins/plotting/ops/mesh.rs"
  }
}