필터 지우기
필터 지우기

How can I fill a circle after using the viscircles command?

조회 수: 47 (최근 30일)
Yeasir Mohammad Akib
Yeasir Mohammad Akib 2022년 9월 26일
댓글: Yeasir Mohammad Akib 2022년 9월 26일
I am plotting some circles with certain radius. I want to fill the circles depeding on their colours. I have used the 'viscircle' command of MATLAB. So how can I improve my code? It seems like the facecolour input is not given for viscircles.
for l=1:length(newlist(:,1))
centers= [newlist(l,1) newlist(l,2)];
r=newlist(l,3);
if r == 1.5
k= [1 0 1]
elseif r==3
k=[0 1 0]
end
viscircles( centers, r,'LineStyle','-','LineWidth',0.1,'EdgeColor',k,'Facecolor',k);
%theta = 0 : 0.01 : 2*pi;
%x = r*cos(theta) + xcenter;
%y = r*sin(theta) + ycenter;
end

답변 (1개)

Image Analyst
Image Analyst 2022년 9월 26일
You'll probably have to use rectangle, which can display circles with solid colors.
  댓글 수: 3
Image Analyst
Image Analyst 2022년 9월 26일
Yes you can use patch or fill though I think it's harder than rectangle because with patch and fill you have to make coordinates for all the perimeter points on the circle.
Yeasir Mohammad Akib
Yeasir Mohammad Akib 2022년 9월 26일
Yes, I have changed the code.

댓글을 달려면 로그인하십시오.

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by