make_custom_patch_l​egend

版本 1.2.2 (2.0 KB) 作者: Jonah Pearl
Make a legend with customized colors and labels, independent of plotted data.
20.0 次下载
更新时间 2020/5/14

查看许可证

[] = MAKE_CUSTOM_PATCH_LEGEND(colors, labels)
MAKE_CUSTOM_PATCH_LEGEND will plot a custom legend on the current figure.
It uses a hack involving invisible patch objects that I don't understand.
COLORS: either a cell array of n MATLAB color strings ('r', 'b', 'k', etc.);
or a column vector of n scalars, which will index into the current colormap;
or a n x 3 matrix of RGB values for each patch.
LABELS: a cell array of n string labels for your legend.
VARARGIN: name/value arguments to pass to legend().

引用格式

Jonah Pearl (2024). make_custom_patch_legend (https://www.mathworks.com/matlabcentral/fileexchange/74952-make_custom_patch_legend), MATLAB Central File Exchange. 检索来源 .

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

Community Treasure Hunt

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

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

Trying again. Added list of default MATLAB colors.

1.2.1

1.2 update push didn't work for some reason.

1.2

Fixed the same spot, so that the for-loop indexing depends on the argument.

1.1

Changed line 49 from length(...) to size(...,1).

1.0.0