Draw an array of colored circles (i.e, "rectangles")
1 view (last 30 days)
Show older comments
Hello!
I would like to know if there is a simpler way to draw an array of colored circles. I have been using rectangles that have curvature to make them circles, created in a loop.
The following code draws one row of circles and then an array of several shorter rows of circles:
% Draw holes row one
for hole = 1:num_holes_row_one
x = (hole) * spacing_row_one;
y = -burden ;
rectangle('Position',[x y w h],'Curvature',[1 1],'facecolor','r');
hole_position_array(hole,:) = [x y];
end
num_holes = num_holes_rest_of_shot;
% Draw holes rest of array
hole_num = 1;
for row = 1:num_rows
for hole = 1:num_holes
this_hole_num = hole_num + num_holes_row_one;
x = ((hole-1) * spacing_rest_of_shot) + spacing_row_one;
y = -(row +1) * burden ;
if kill_me(this_hole_num) == 0
rectangle('Position',[x y w h],'Curvature',[1 1],'facecolor','r');
end
hole_position_array(this_hole_num,:) = [x y];
hole_num = hole_num + 1;
end
end
"kill_me()" is an array showing which are not to be printed. Is there a tool for multiple rectangles? Any thoughts on this are appreciated.
Doug Anderson
2 Comments
Image Analyst
on 2 Dec 2018
Please give us code that runs. What is num_holes_row_one? Also give any other variables that we'll need to run your code.
Answers (0)
See Also
Categories
Find more on Resizing and Reshaping Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!