Re-use the view output matrix in Matlab

后端 未结 2 863
旧巷少年郎
旧巷少年郎 2021-01-22 13:46

In Matlab, I create a fairly complicated 3D plot, then manipulate the view option by hand up to a point where I am happy with what I see (below). How can I reuse the parameters

2条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-22 14:03

    In order to get something out of view that you can then pass to view to reconstruct the viewpoint, you need to specify two outputs to view which will yield the current azimuth and elevation.

    [az, el] = view(ax1);
    

    You can then pass these to view on a different (or the same) axes to specify the viewpoint

    view(ax2, az, el);
    

    You can also use the View property of the axes object.

    AzEl = get(ax1, 'View');
    set(ax2, 'View', AzEl);
    

    Note, however, that there are many properties which control the view of an axes including the Projection, the DataAspectRatio, the PlotBoxAspectRatio and all of the camera properties. Depending on your use case, you may need to specify these as well.

提交回复
热议问题