Plot not updating even after changing plot data
46 ビュー (過去 30 日間)
古いコメントを表示
Arkaniva Sarkar
2021 年 10 月 24 日
回答済み: Walter Roberson
2021 年 10 月 24 日
I am plotting lines on a surface plot in a GUI and trying to update the lines by changing XData,YData and ZData, but the lines are not updating.
% example
plt = surf(X,Y,Z) %surface plot
hold on
line_plt1 = plot3([1 2],[1 3],[5 8],'r-');
if ishandle(line_plt1)
set(line_plt1,'XData',[2 3],'YData',[3 4],'ZData',[5 5])
drawnow
end
The plot data gets updated after using set(handles,'Name',Value,..) but somehow the plot is not updating even after the plot data is changed. I've tried using refreshdata and linkdata but that's also not working.
Can anyone suggest any other way to update the plot?
2 件のコメント
Chris
2021 年 10 月 24 日
This code works fine for me. Can you see the line? Is it possible it's obscured by the surface, or that the axis limits are inappropriate?
採用された回答
Walter Roberson
2021 年 10 月 24 日
You are not plotting into the axes you think you are plotting into.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Visual Exploration についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!