MATLAB: How to plot the contours of the xy, xz, and yz planes of a 3d scatter plot on the same axes

3d plotcontourMATLABscatter3

I was asked to plot the contours of the xy, xz, and yz planes of a 3D scatter plot on the edge of the plot box. I've included a figure to show how far I've gotten. The figure uses 4 calls of the scatter3 funtion with the projections using a fixed third dimention. When I try to plot the countours instead of the projections, the contours all appear on the x-y plane at z=0, with the wrong scale. Is this even possible?

Best Answer

  • An approach that can work (though not convenient)
    Create 3 different hgtransform groups. Create three different 2d contour plots, each from a max projection of the 3d data against a different axis. Parent each of the contour plots against a different hgtransform, and set the different hgtransform projection matrices to rotate the 2d contour to up against the appropriate axes.