フィルターのクリア

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

1 回表示 (過去 30 日間)
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")

採用された回答

Sanita Dhaubanjar
Sanita Dhaubanjar 2022 年 3 月 2 日
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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeScatter Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by