Specifying color data for patchm or patchesm
Show older comments
How do I specify different colors for different faces of my patch on map axes, using "patchm" or "patchesm"? I want to create a patch object that has multiple faces, and I want to color the faces differently.
When I attempt to pass a vector of color values, which has the same length as the number of faces, as the "cdata" parameter to either "patchm" or "patchesm" I get the error "Color value must be a 3 element numeric vector". My code is as follows:
>> load coastlines
>> axesm sinusoid;
>> framem
>> numOfFaces = 243;
>> colormap(jet(numOfFaces))
>> caxis([1 numOfFaces])
>> zVal = 0;
>> colorData = (1:numOfFaces)';
>> h = patchm(coastlat, coastlon, zVal, colorData, 'FaceColor', 'flat');
Similarly, "patchesm" gives the same error if I pass a vector as the "cdata" parameter.
Accepted Answer
More Answers (0)
Categories
Find more on Polygons in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!