필터 지우기
필터 지우기

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 CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by