How to apply colourmap onto shapes
1 次查看(过去 30 天)
显示 更早的评论
I would like to set the colour of each circle according to a given value. (See attached image) The graph must contain this matrix of circles coloured using colourmap.
How do I draw the circles and apply the colourmap to them?
![](/matlabcentral/answers/uploaded_files/86783/Colormap.jpg)
1 个评论
Adam
2017-8-31
The answer to what is in your question title would be fairly trivial if you actually had the representation of the shapes, but in the body of your question you casually tag on asking how to draw the circles in the first place, which is less easy (or at least not something I am familiar with doing). I would imagine you can parameterise a patch object with the parametric description of a circle, but it's not something I've ever needed to do.
采纳的回答
José-Luis
2017-8-31
radius = 2;
c_x = 1;
c_y = 1;
numElem = 100;
x = linspace(0,2*pi,numElem);
y = x;
x = radius.*cos(x) + c_x;
y = radius.*sin(y) + c_y;
patch([x,x(1)],[y,y(1)],rand(1,3))
axis equal
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polygons 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!