plot multiple rectangles/circles in the same frame, hold on
4 ビュー (過去 30 日間)
古いコメントを表示
Hi I want to plot any desired number of circles in one plot for a billiard game. Creating each rectangle for itself isnt so handy because I would like to plot theoratically an infinite number of balls.
Thats why I wondered if its possible to plot the same object/rectangle at different positions at the same time. I tried using hold on. But it shows still only one ball.
hold on
for k1 = 1:length(t) %t = timestep
for k2 = 1:4:num_variables %this loop iteration should pick and plot one ball, ...
% which then needs to be held until all balls are plotted and a new timestep can be started
%k2 refers to x-value column, k2+2 refers to y-value column
set(redball,'Position',[y_total(k1,k2)-r, y_total(k1,k2+2)-r, 2*r, 2*r]);
end
How would you solve this?
Thanks in advance!!
0 件のコメント
回答 (1 件)
KSSV
2021 年 2 月 18 日
To plot them you can specify the centers and use markers, increase the size of markers. Have a look on plot.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Creating, Deleting, and Querying Graphics Objects についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!