Why delete(findobj(gca,'type', 'patch')) is not working for erasing scattered points ?
1 回表示 (過去 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!