How do I change the colors of circles that I draw using the viscircles function?

조회 수: 4 (최근 30일)
I'm trying to draw circles in an image whereby if the circles' radii are outside a particular threshold, they get colored in with a different color. However, I keep getting an error when I write in the following line of code.
viscircles(centers, radii, 'Color', 'g')
The error is as follows:
Error using viscircles>parseInputs (line 175)
Unknown input string: Color.
How would one get around this issue?
Thank you for your help.
P.S. I'm currently using Matlab R2015a.

답변 (1개)

Walter Roberson
Walter Roberson 2017년 6월 29일
Note for readers: viscircles only permits one color to be set for all of the circles it draws in one call. At the underlying level, it use a line object for all of the circles themselves, and a second thicker line object for the edges of the circles, counting on the thinner object to only overlay part of the thicker object to create edging on both sides. The point here being that line objects are restricted to a single color each, so it is not possible to use different colors for different circles created in a single viscircles() call.
  댓글 수: 4
Becky CNS
Becky CNS 2018년 2월 28일
Then how DO you change the colour following the viscircles function?
Walter Roberson
Walter Roberson 2018년 3월 1일
h = viscircles([0 0;1 1; 2 2],[5 8 10]);
h.Children(1).Color = 'w'; %change the color of the thinner inside line
h.Children(2).Color = 'k'; %change the color of the edging

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

Community Treasure Hunt

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

Start Hunting!

Translated by