Specifying color data for patchm or patchesm
显示 更早的评论
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.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Polygons 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!