interactivelegend

版本 1.2.0.0 (14.6 KB) 作者: Grégoire Surrel
Highlights and identifies a selected plot object. (Update from fileexchange/4031-interactivelegend)
36.0 次下载
更新时间 2017/3/8

查看许可证

This is an update of interactivelegend by Francois Bouffard:
https://ch.mathworks.com/matlabcentral/fileexchange/4031-interactivelegend
Original description:
This function enables a set of plot objects to become interactive. The mouse pointer becomes a crosshair, and selected plots are highlighted (that is, brought to the top of the axes, colored red and drawn with a linewidth of 2).

An optional text tag is also drawn with the same color, thus replacing the need for a conventional legend, which can become cumbersome when lots of plots are present in the same axes. By default, shown tags are the plot's 'Tag' property, but they can also be provided as an optional argument.

Only one plot remains highlighted at a time; when the user clicks on the axes background, all plots return to their unselected state.

An optional structure can be passed to the function to adjust the look of highlighted plots and text tags.

Usage example:

p = plot(randn(40,5));
set(p,'Color',[0.6 0.6 0.6]);
tags = {'A','B','C','D','E'};
interactivelegend(p,tags);

Note that the following syntaxes would also work:

interactivelegend(gca,tags);

See also the contributed function "linelabel" by Scott Hirsch, which behaves similarly but with persistent tags.

引用格式

Grégoire Surrel (2024). interactivelegend (https://www.mathworks.com/matlabcentral/fileexchange/61951-interactivelegend), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2014a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Legend 的更多信息
致谢

参考作品: interactivelegend

Community Treasure Hunt

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

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