File Exchange

image thumbnail


version (1.5 KB) by Matthew Whitaker
Makes lines or line children of axes highlightable

1 Download

Updated 13 Nov 2007

No License

% MAKELINEHIGHLIGHTABLE sets the ButtonDownFcn of lines or line children
% of axes so that when the line is clicked the line width is increased or
% decreased. when the line is clicked again the line width returns to the
% original value.
% MAKELINEHIGHLIGHTABLE(H,HIGHLIGHTPOINTS): H is a line or axes handle or a vector of line and/or axes handles
% HIGHLIGHTPOINTS(optional) is the number of points to
% increase (or decrease) the line width when the line is clicked. If not
% supplied the default value is 2.
% MAKELINEHIGHLIGHTABLE(H,0): turns off the highlightable ButtonDownFcn for the line handles in H.
% Examples:
% h = plot(1:10,rand(10));
% makeLineHighlightable(h) %increase line width by 2 when clicked
% a = get(h(1),'Parent');
% makeLineHighlightable(a,5); %increase by 5 all lines in the axes
% makeLineHighlightable(h(1:5),0); %turn off the first 5 lines highlighting
% makeLineHighlightable(a,0); %turn off all the lines highlighting

Cite As

Matthew Whitaker (2021). makeLineHighlightable (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (5)


Great job! It works perfectly with the current release (R2007b).

saeed iqbal

i opened this site and i liked it very much.


I have a naive question. If I open Figure Palette (ML R14) in figure window, I get any line object highlighted if I click it. This is reasonable, because it allows to see gco. Apparently, in the submission discussed here the highlighting has some other meaning. Which one?

Another question is for Doug. If I open uicontextmenu for gco with right button, I see option CUT, but there are no important options MOVE, BLOW UP/DOWN (both implemented in RECTANGLE AND ELLIPSE), and ROTATE (strangely, Rotate3D button in main toolbar cannot rotate single objects within fixed 2D axis). Of course, one can modify uicontextmenu, but such options are very general, why not yet implemented?

Furthermore, if I have a line object within RECTANGLE or ELLIPSE brought into axis from Annotations,instead of that object only RECTANGLE or ELLIPSE are always selected by clicking the line object. This seems to me inconsistent. What is the explanation for that? Apparently, RECTANGLE and ELLIPSE consider not only the perimiter, but also inner points as their own property. This is very inconvenient for users.

Doug Hull

This file is the first winner of the LazyWeb challenge I posted on my Blog.

Matthew Whitaker

Revision submitted to turn off other lines when highlighting a line

MATLAB Release Compatibility
Created with R2006b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!