Borrar filtros
Borrar filtros

How do i shift scatterpoint along the yaxis based on size of scatter point radius?

1 visualización (últimos 30 días)
I want to plot my data as scatter points that lay on top of each other but have different symbol size. Currently I can plot the data as concentric circles like this where the center of the cirlces overlap.
Is it possible to shift the second layer of circles so they overlap at the bottom edge of the first circle that is always bigger than the second one like this?
Here is an example of my issue:
figure;
sz=50 + (1000-50).*rand(1,4);
scatter(1:4, zeros(1,4), 100 + (1000-100).*rand(1,4),"filled")
hold all
scatter(1:4, zeros(1,4), 50 + (100-50).*rand(1,4),"filled")
scatter(1:4, zeros(1,4), 5 + (50-5).*rand(1,4),"filled")

Respuesta aceptada

Sanita Dhaubanjar
Sanita Dhaubanjar el 2 de Mzo. de 2022
Could not find a solution to this using scatter or bubblechart. But for now I have a work around using the rectangle function based on another answer here. This works but it is not possible to make the circles transparent in this
%% Circles w same base and xy= left bottom corner
Xbottom=[1:6]';
Ybottom=[1:6]';
Couter= rand(6,1)*6;
Csize=[Couter/2 Couter/3 Couter/7];
Colmap=lines(3);
figure
arrayfun(@(x,y,diameter) rectangle('Position', [x, y, diameter, diameter], 'Curvature', [1 1], 'EdgeColor', 'k','FaceColor',Colmap(1,:)), Xbottom, Ybottom, Couter);
for ii=2:size(Csize,2)
arrayfun(@(x,y,diameter,diameter_outer) rectangle('Position', [x+diameter_outer/2-diameter/2, y, diameter, diameter], 'Curvature', [1 1],'EdgeColor', 'w','FaceColor',Colmap(ii,:)), Xbottom, Ybottom, Csize(:,ii),Couter);
end
axis equal

Más respuestas (0)

Categorías

Más información sobre Scatter Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by