Why delete(findobj(gca,'type', 'patch')) is not working for erasing scattered points ?
조회 수: 7 (최근 30일)
이전 댓글 표시
Here's a simple snippet that shows that
delete(findobj(gca,'type', 'patch'))
is not working for erasing scattered points:
figure
x = [1,2,3,4]
y = [1,2,3,7]
scatter(x,y,50);
delete(findobj(gca,'type', 'patch')) % not working
%delete(findobj(gca,'SizeData', 50)) % does work
Uncommenting the last line solves the problem, but this is a workaround, or what ?
댓글 수: 0
채택된 답변
Adam Danz
2020년 1월 13일
편집: Adam Danz
2020년 1월 14일
"Why delete(findobj(gca,'type', 'patch')) is not working for erasing scattered points ?"
Instead,
delete(findobj(gca,'type', 'scatter'))
Or better yet, use the scatter output which does not require the use of the axis handle and is more responsible since you're deleting a specific object rather than deleting all existing matches to an object type within the current axes.
s = scatter(. . .);
delete(s)
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Graphics Object Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!