Contour on image or pcolor in Matlab 3D plot

To overlay a contour on top of a Matlab “image()” or “pcolor()”, first rasterize the image and then overlay a contour to make it work in a 3-D Matlab figure. This is a bit complex to describe, so we created an example of contour over image in a 3-D Matlab figure: contourImage2.m. This script follows these steps:

  1. flatten the contour onto the image in the default z=0 plane
  2. render as a resized image
  3. make a pcolor plot
  4. manipulate the underlying Surface object to an arbitrary 3-D location.

Doing a contour overlay on a 2-D image or pcolor is much simpler especially in Python.