How do I add scale markers to the legend, to indicate values for the sizes of points in a scatter plot?

조회 수: 10 (최근 30일)
Hello,
I have the scatter plot showing a 4 dimentional data set. It was generated using:
scatter(dimentionA,dimentionB,dimentionC,dimentionD,'filled','MarkerEdgeColor','w')
The x-y axis, cover 2 dimentions, the colourbar covers the 3rd and the point sizes cover the 4th dimention.
How do I add a point size/scale indicator to the legend, in order to lebel the 4th (point sizes) dimention?
Thanks!

채택된 답변

Bjorn Gustavsson
Bjorn Gustavsson 2020년 9월 25일
I'd do something like:
sz = 12:2:24; % your suitable selection for your dimentionC-mapping-to-size
y4size = linspace(45,110,numel(sz));
x4size = 15*ones(size(y4size));
scatter(x4size,y4size,sz,'k','filled')
for it = 1:numel(sz)
text(15.5,y4size(it),sprintf('%3.1f',Cval(it)))
end
You'll have to fill in your suitable range of values of your dimentionC-data that you want to display the size of the scatter-points for, and also change the 12:2:24 to something suitable. But this should give you something to start with.
HTH
  댓글 수: 6
Bjorn Gustavsson
Bjorn Gustavsson 2020년 9월 26일
My pleasure.
The file exchange is GREAT, I've gotten so much useful stuff there that I've no idea how much time and effort I've saved through the years. My first step when solving a problem is to have a look there for a solution...

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Legend에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by