problem with scatter/bubble plot
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
hi,
i have created a vector containing coordinates of a circle in a matrix.
i want to display these locations as dots in a plot.further i want to color these dots in a clockwise increasing color scheme. i have written a code but experienced a problem : the color vector which i created does not seem to be mapped linearly to my location points
code:
matrix = ones(512,512);
mittelpunkt_x = 256;
mittelpunkt_y = 256;
radius = 33;
for i=1:size(matrix,1)
for j = 1:size(matrix,2)
matrix(i,j) = norm([i j]-[mittelpunkt_x,mittelpunkt_y],2);
if matrix(i,j)<=radius
matrix(i,j)=0;%10;
elseif matrix(i,j)<radius+1 && matrix(i,j)>radius
matrix(i,j)=1;
else
matrix(i,j)=0;
end
end
end
b=0.00490196078
[r,c]=find(matrix==1);
color=[b:b:1];
y=[r c];
scatter(r,c,50,color,'filled')
i hope someone can help me with this
g3rm9
0 Commenti
Risposta accettata
bym
il 28 Dic 2011
something like this?
t = 0:pi/6:2*pi
t(13)=[];
x = cos(t);
y = sin(t);
c = spring(12);
scatter(x,y,[],c,'filled')
4 Commenti
Più risposte (1)
the cyclist
il 28 Dic 2011
I'm not sure I understand what the problem is. When I run your code, I see a circle with varying color going around it, which I assume is what you want. It may not look like a circle, because the displayed axes do not have equal aspect ratio. You may want to put the following code after your scatter() command:
>> axis equal
>> axis square
If that is not what you mean, then you will need to be more explicit by what "mapped linearly to my location points" means.
Vedere anche
Categorie
Scopri di più su Annotations in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!