Upper limit on the number of UIAxes children allowed

7 ビュー (過去 30 日間)
Kurt
Kurt 2023 年 11 月 1 日
編集済み: dpb 2025 年 5 月 9 日
I am plotting orbital data, using plot3 to progressively lengthen the orbital track of a spacecraft.
plot3(earthMoon.UIAxes, x,y,z,"w');
Each time I do this, another "Children' is added to the UIAxes instance. Eventually, when the number of children approaches 200 or so, the graphical object management becomes unwieldy and my GUI stops responding to button pushes; even the Matlab STOP and CONTINUE buttons fail to respond.
I found a similar question and answer here:
Is there a better way to manage the Children? I have tried thinning out my track data to reducte the number of points, but that results in jerky updates that don't align with the orbital state. I have also looked at using splines, but I will still need to limit the number of current track points to something under 200.
I have another app for displaying radar data where I progressively delete the oldest children in the UIApp, so I never have more than about 50. That works well, but for orbital data I would like to display the whole trajectory from launch to current time. It appears I can't have it both ways.
  4 件のコメント
dpb
dpb 2025 年 5 月 8 日
編集済み: dpb 2025 年 5 月 9 日
"...when you use scatter plots, which quickly add reams of children to the axes object"
You can avoid scatter by using
hL=plot(x,y,'o');
then follow the preceding advice to update the X|YData of the given line handle. There will have to be one line for each desired marker/color combination, however, since those properties are unique to the object handle.
I've not experimented with the animatedline with the idea of it being a scatter substitute so not positive about it with only the marker but I presume it will allow that...
Walter Roberson
Walter Roberson 2025 年 5 月 8 日
plot() and scatter() scale at about the same rate, but plot() is a bit faster. See https://blogs.mathworks.com/graphics/2015/01/20/performance-scaling/

サインインしてコメントする。

採用された回答

Voss
Voss 2023 年 11 月 1 日
Consider updating the XData, YData, and ZData of an existing line, rather than creating a new line each time you want to add more data to the plot.
For that, you can use a line object (such as what plot3 creates), or you may find it convenient to use an animatedline object.
  2 件のコメント
Kurt
Kurt 2023 年 11 月 1 日
The animatedline approach worked. Thanks!
Voss
Voss 2023 年 11 月 1 日
You're welcome!

サインインしてコメントする。

その他の回答 (1 件)

dpb
dpb 2023 年 11 月 1 日
Don't call plot3 (or friends) multiple times for such, update the data properties of the one having been called or use the animatedline instead.

カテゴリ

Help Center および File ExchangeGeographic Plots についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by