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

3 ビュー (過去 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 件のコメント
Hamid Attar
Hamid Attar 2020 年 9 月 25 日
Thanks a lot, I figured it out using the first link. Very helpful!
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 Center および File ExchangeLegend についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by