drawing point by point matlab using plot or another function instead of viscircle

Hello, I need to draw point by point, but the points should be a little bit big so i already did a program and worked with viscircle, but i saw that visrcle can't allow us to fill in the circles so now i should change my methode so tried to use the plot but didn't work correctly can you suggest me any idea to change this program to another one using plot or line or what else. i'm working on a gui.
function start_Callback(hObject, eventdata, handles)
axes(handles.axes1)
axis(gca,'equal');
axis([0 120 0 (110)]);
for x=0:(distance/1000):(bounce/2)
y=a*x.^2 + hauteur;
p2=[x y];
p2_traj= viscircles(p2,0.6);
pause(0.0001);
delete(p2_traj);
if rebounce ==1 && y<= rebounce1
newrow=[rebounce1,0,0,0];
break;
end
end

5 Comments

If you are plotting point by point...why don't you use markers and change the marker size?
because when i change the viscircle by plot i haver something very weird happening to my graph, it's like the camera is zooming on the point and i have the point that's moving.
i don't know haw can i explain this.
but pehaps i didn't do it correctly i'll try again .
As mentioned, use plot and change the marker:
plot(x,y,'marker','o','markersize',20)
That should create a circle with a certain size. That is the easiest way to do it.
I'll do it again and i'll show you what did it gave me
Additionally, if you want the markers themselves to be filled, you can set the MarkerFaceColor property. However, if you want the plotted area to be filled then use the fill function. Both of these are visualised in the code below:
% Define the number of data points
numPoints = 100;
% Define the radius of the circle
radius = 4;
% Create an array of angles from 0 to 2*pi
theta = linspace(0, 2*pi, numPoints);
% Calculate the x and y coordinates of the circle
x = radius * cos(theta);
y = radius * sin(theta);
% Plot and fill the circle
figure;
fill(x, y, 'c'); % 'c' is for cyan fill; you can choose other colors
hold on;
plot(x, y, 'o', 'MarkerFaceColor', 'b'); % Plot the outline with solid markers
axis equal; % Ensure the aspect ratio is equal to make the circle look round
title('Circle with Radius 4 Units');
xlabel('X-axis');
ylabel('Y-axis');
grid on;
You can reference the documentation for customising marker property in the following documentation link below:
Further, to reference the fill function's documentation, visit the link below:

Sign in to comment.

Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Asked:

on 18 Jul 2018

Commented:

on 29 Nov 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!