plot multiple rectangles/circles in the same frame, hold on
조회 수: 6 (최근 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!