I am trying to create an scatter plot as shown below from a regular scatter plot.
The objetive is that the size of the marker corresponding to a certain area becomes dependant of the number of points in that area.
Does anybody know how to do this?

 채택된 답변

Steven Lord
Steven Lord 2022년 12월 5일

0 개 추천

The size input argument to the scatter function can be a scalar or an array of the same size as the coordinate data. In the example below the marker at coordinates (10, 100) is much larger than the marker at coordinates (1, 1).
x = 1:10;
y = x.^2;
scatter(x, y, 2*y)

댓글 수: 3

Thank you Steven.
I am aware there can be different sizes, I am trying to link them to the relative number of points of the certain area containing those points.
Actually triying with a bivariant normal distribution, but my computer rans out of memory for my number of points (x and y of 20300 points each)
Steven Lord
Steven Lord 2022년 12월 5일
Ah, so the problem you're trying to solve is how to bin the data to generate the array of marker sizes? I think the histcounts2 function will help you with that task.
Thank you, this has worked

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Scatter Plots에 대해 자세히 알아보기

제품

릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by