plot multiple rectangles/circles in the same frame, hold on
15 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
KSSV
il 18 Feb 2021
To plot them you can specify the centers and use markers, increase the size of markers. Have a look on plot.
0 Commenti
Vedere anche
Categorie
Scopri di più su Creating, Deleting, and Querying Graphics Objects in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!