runmat-runtime 0.4.5

Core runtime for RunMat with builtins, BLAS/LAPACK integration, and execution APIs
Documentation
{
  "title": "view",
  "category": "plotting",
  "keywords": [
    "view",
    "3-D camera",
    "azimuth elevation",
    "matlab view",
    "rotate 3-D plot"
  ],
  "summary": "Control 3-D camera angles for surfaces and spatial plots using azimuth/elevation views and MATLAB `view` semantics.",
  "requires_feature": null,
  "tested": {
    "unit": "builtins::plotting::view::tests"
  },
  "description": "`view` reads or updates the camera orientation for the current axes or an explicit axes handle. In RunMat it stores subplot-local azimuth and elevation state, supports MATLAB `view(2)`, `view(3)`, `view([az el])`, and `view(az, el)` call forms, and integrates with the same handle/property system used by `get` and `set`.",
  "behaviors": [
    "`view` with no angle arguments queries the current `[az el]` pair.",
    "`view(2)` selects the standard top-down 2-D camera and `view(3)` restores the standard 3-D camera preset.",
    "Explicit azimuth/elevation values can be passed as two scalars or as a two-element vector.",
    "View state is subplot-local and does not leak across different axes in a subplot grid.",
    "Axes handles can be passed explicitly so camera changes target a specific subplot rather than whichever axes happens to be current."
  ],
  "examples": [
    {
      "description": "Set an explicit 3-D camera angle",
      "input": "[X, Y] = meshgrid(linspace(-2, 2, 60), linspace(-2, 2, 60));\nZ = sin(X.^2 + Y.^2);\nsurf(X, Y, Z);\nview(45, 30);"
    },
    {
      "description": "Use MATLAB-style view presets",
      "input": "[X, Y] = meshgrid(linspace(-3, 3, 40), linspace(-3, 3, 40));\nZ = sin(X) .* cos(Y);\nsurf(X, Y, Z);\nview(2);\nview(3);"
    },
    {
      "description": "Query a subplot-local camera",
      "input": "ax = subplot(1, 2, 2);\nplot3(cos(0:0.1:5), sin(0:0.1:5), 0:0.1:5);\nview(ax, [60 20]);\nget(ax, 'View')",
      "output": "% Returns a 1x2 vector [60 20]"
    }
  ],
  "faqs": [
    {
      "question": "What do azimuth and elevation mean in view(az, el)?",
      "answer": "Azimuth is the horizontal rotation around the z-axis (0° looks along the y-axis toward the origin). Elevation is the angle above the x-y plane (0° is level, 90° is directly overhead). `view(45, 30)` gives the classic isometric-ish perspective for 3-D surfaces."
    },
    {
      "question": "How do I reset to the default 2-D or 3-D view?",
      "answer": "`view(2)` sets the camera to top-down (azimuth 0, elevation 90) — useful for looking at a surface as a heatmap. `view(3)` restores the default 3-D camera at `[-37.5, 30]`, which is the standard MATLAB 3-D preset."
    },
    {
      "question": "Can I set different view angles per subplot?",
      "answer": "Yes. View state is subplot-local. Pass the axes handle explicitly to target a specific panel.\n\n```matlab\nax1 = subplot(1, 2, 1); surf(X, Y, Z); view(ax1, 0, 90);\nax2 = subplot(1, 2, 2); surf(X, Y, Z); view(ax2, 45, 30);\n```"
    }
  ],
  "links": [
    {
      "label": "plot3",
      "url": "./plot3"
    },
    {
      "label": "scatter3",
      "url": "./scatter3"
    },
    {
      "label": "surf",
      "url": "./surf"
    },
    {
      "label": "zlabel",
      "url": "./zlabel"
    },
    {
      "label": "get",
      "url": "./get"
    },
    {
      "label": "set",
      "url": "./set"
    },
    {
      "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/view.rs`",
    "url": "https://github.com/runmat-org/runmat/blob/main/crates/runmat-runtime/src/builtins/plotting/ops/view.rs"
  }
}