获取 min/max-value 的 3d 图

Get min/max-value of 3d-plot

我在 MATLAB 中有一个由许多 3d 线组成的 3d 图(来自 line([...],[...],[...],...))。如果我用鼠标和旋转工具(图中的可点击图标-window)旋转图,MATLAB 会一直重新缩放轴。我知道可以使用 axis([...]) 手动调整轴限制,但我不知道 3d 线或表面对象的 min/max-values。

您可以通过键入 surf(peaks) 自行测试。轴在 0-50 和 0-60 之间不断变化。我正在使用 R2011a。

对于如何获取组合 3d-lines/3d-surface-meshes 的 3d-min/max 值以便能够手动设置轴限制,您有什么建议吗?

谢谢

我想您还没有发现命令 axis。来自 the documentation:

axis vis3d

Freeze the aspect ratio properties. Sets the plot box aspect ratio mode and data aspect ratio mode properties to manual.

示例:

> surf(peaks);
> axis vis3d

...不再有随机轴缩放更改。

如果您真的需要提取数据的min/max(极少数情况),您可以使用以下内容:

plots = get(gca, 'children');
zdata = get(plots, 'zdata');
if isscalar(plots)
    zdata = {zdata}; end

maxZ = cellfun(@(x)max(x(:)), zdata);
minZ = cellfun(@(x)min(x(:)), zdata);