Plotting circles on a 2D graph

Hello everyone,
I'm trying to plot a graph showing distribution of some data with different size. So I need to plot it on a 2D graph according to size. So basically I would like to define where the droplets are on the x axis according to size as the y will be 0 except for the the initial beige amount of droplets. How do I define the position on the x-axis and the frequency of the droplets and the best way to project it on to these two axes? For example, the 2000 micrometer is on the y-axis at 0 and x-axis 0.06m.
Thanks

 Respuesta aceptada

KSSV
KSSV el 14 de Ag. de 2020
If you know radius and center of cricle, you can plot circle as below:
C = rand(1,2) ; % center of circle
R = 1. ; % RAdius of circle
th = linspace(0,2*pi) ;
x = C(1)+R*cos(th) ;
y = C(2)+R*sin(th) ;
plot(x,y)
In your case, you can use scatter also. Read about it.

5 comentarios

asd ad
asd ad el 14 de Ag. de 2020
x = linspace(0,3*pi,200);
y = cos(x);
sz = linspace(1,100,200);
c = linspace(1,10,length(x));
scatter(x,y,sz,c,'filled')
So I read about this scatter function but I'm not quite sure how it works. I have 29 different sizes and all of them on the y=0. Since I have 29 different sizes should I make a matrix? But I'm not sure how to proceed with it then. I have attached my raw data on the excel file. The frequency is the amount of droplets of the same size and the rest is scattered on the y = 0 axis. The formula to caluate x is in the excel file which is pretty easy.
KSSV
KSSV el 14 de Ag. de 2020
num = xlsread("Raw data.xlsx") ;
R = num(:,1) ; % sizes
x = 1:length(R) ;
y = zeros(size(R)) ;
scatter(x,y,R,R,'filled')
asd ad
asd ad el 14 de Ag. de 2020
I just tried that and it's something that I think fits well but the x-axis values are wrong. It's supposed to be from 0 to 1.18 but this is going till 30. And how do I make the circles in a descending order of sizes instead of ascending? So like big circles at the beginning and small ones at the end?
Thanks for your help
KSSV
KSSV el 14 de Ag. de 2020
num = xlsread("Raw data.xlsx") ;
R = num(:,1) ; % sizes
x = linspace(0,1.18,length(R)) ;
y = zeros(size(R)) ;
R = R(end:-1:1) ; % Reverse R
scatter(x,y,R,R,'filled')
asd ad
asd ad el 15 de Ag. de 2020
thank you. it works

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.

Preguntada:

el 14 de Ag. de 2020

Comentada:

el 15 de Ag. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by