How can I change the color of an alphaShape object when using plot?

조회 수: 6 (최근 30일)
Leonard
Leonard 2015년 1월 27일
댓글: 俊鹏 陈 2022년 6월 21일
I have a 3-D object which I've converted to a very nice looking alphaShape object after getting the PixelIdxList and using ind2sub to get the coordinate of each voxel.
As awesome as they look, I really really need to change the color of some of the objects to anything other than the default green. Any idea on how to change the color?

채택된 답변

Sean de Wolski
Sean de Wolski 2015년 1월 27일
You can grab the handle to the patch objects making up the alpha shape as the output from plot and then change whatever properties of it you want:
data = randn(100,3);
as = alphaShape(data);
h = plot(as);
h.FaceColor = 'b';
  댓글 수: 1
俊鹏 陈
俊鹏 陈 2022년 6월 21일
I'm sorry to bother you!
What if you wanted my graphics to have a regular gradient of color, like a rainbow. Rather than a single color.It could be like this picture, or even more beautiful.
Looking forward to your reply.

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

추가 답변 (1개)

Image Analyst
Image Analyst 2015년 1월 27일
Not sure what you're doing, but a huge number of MATLAB graphics functions have a 'Color' input parameter. Check for that.
  댓글 수: 1
Leonard
Leonard 2015년 1월 27일
Thank you for your response. I did check for these features but it did not work in the traditional sense:
plot(shape,'Color',[0.5,0.5,0.5])
Instead, I went into the plot.m for alphaShapes, and noticed that there is a default color called "yellowgreen". I am able to copy-paste this entire file, save and rename it, and adjust the color to my liking. Using "hold on" and these steps, I should be able to achieve the desired result! Will update here if it works!

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

카테고리

Help CenterFile Exchange에서 Bounding Regions에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by