plot multiple rectangles/circles in the same frame, hold on
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
KSSV
el 18 de Feb. de 2021
To plot them you can specify the centers and use markers, increase the size of markers. Have a look on plot.
0 comentarios
Ver también
Categorías
Más información sobre Line Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!