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

11 次查看(过去 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