The "cdata" parameter of both the "patchm" and "patchesm" constructor expects to receive a singular color value, specified as either a color name (e.g. 'r' or 'red') or an RGB triplet (e.g. [1 0 0]). It will not take in a vector of color values that correspond to the different face colors.
Unlike "patch", providing a scalar value for "cdata" in the constructor for "patchm" or "patchesm" does not use the "CDataMapping" property to map into the colormap.
However, since "patchm" supports nearly all the properties that are supported by the "patch" function, we can color the faces by passing property name/property value pairs to the "patchm" function, as follows:
>> patchm(latData, lonData, 'FaceVertexCData', faceColors, 'FaceColor', 'flat')
This command will create a single patch with multiple faces, with the face colors specified by the array "faceColors". Specifics on the allowed formats of the array "faceColors" can be found on the Patch Properties documentation page, under the property "FaceVertexCData", linked here:
Since "patchesm" returns an array containing a separate patch object for each face, it is necessary to set the color of each of the patch objects individually to accomplish the same behavior.
For more information about these properties, please refer to the above link.
Best Answer