Legend Scatter

版本 1.0.5.0 (8.9 KB) 作者: Matteo Bagagli
LEGENDSCATTER: workaround for R2016a and later for scatter plot legend.
215.0 次下载
更新时间 2017/9/2

查看许可证

This function aims to simplify the creation of a legend for scatter plots.
The function will plot a legend on current axis with the right
markersize proportion.
NB. From version 1.0.5 is added the compatibility with previous MATLAB
version.
-------------------------------------------- INPUTS
- TextCell: a cell array containing the legend-entry text.
WARNING: THE FIRST CELL IS THE TITLE !!!
- SizeDim: the ''MarkerSize'' dimension for each entry.
WARNING: length(SizeDim)==length(TextCell)-1 !!!

- Factor: normaling factor for enlarge the marker size in
a linear way. (MarkerSize*sqrt(Factor)

- LinSpec: specify the marker-string.

-------------------------------------------- EXAMPLE
Factor=1.5;
A=[1,1,1;
2,2,2;
3,3,3;
4,4,4;
5,5,5;
6,6,6;
7,7,7;
8,8,8;
9,9,9;
10,10,10];

sh=scatter(A(:,1),A(:,2),(A(:,3).^2)*Factor,'ok');
%scattersize==MarkerSize*sqrt(Factor)pt)
leg=LEGENDSCATTER({'SIZE','1','2','3','4','5', ...
'6','7','8','9','10'},[1:1:10],Factor,'ok');
leg.Location='NorthWest'; axis([0,11,0,11])

-------------------------------------------- INFO
VERSION:1.0.5
AUTHOR: Matteo Bagagli - ETH-Zurich // Oct. 2016
MAIL: matteo.bagagli@erdw.ethz.ch

引用格式

Matteo Bagagli (2024). Legend Scatter (https://www.mathworks.com/matlabcentral/fileexchange/59425-legend-scatter), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2016a
兼容任何版本
平台兼容性
Windows macOS Linux
致谢

启发作品: velest2mat

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.5.0

Added compatibility with previous MATLAB releases.
Improved help.
Improved help

1.0.0.0