Serving the Quantitative Finance Community

 
User avatar
ana3a
Topic Author
Posts: 0
Joined: December 6th, 2007, 10:49 am

Matlab wandering legend

August 1st, 2008, 10:52 pm

i have plot legends in a GUI that are drag-and-droppable. it's very annoying. i want to turn off the drag-and-drop.is there a way to do this?i turned off the HitTest property but that doesn't help.
 
User avatar
spmacdonald
Posts: 0
Joined: February 18th, 2008, 5:42 pm

Matlab wandering legend

August 2nd, 2008, 6:54 pm

Try setting the legend's buttondown callback fucntion to null.maybe this example will help you:x=0i;y=sin(x);plot(x,y);h=legend('sin');set(h,'ButtonDownFcn','');
 
User avatar
ana3a
Topic Author
Posts: 0
Joined: December 6th, 2007, 10:49 am

Matlab wandering legend

August 2nd, 2008, 7:33 pm

works wonders, thanks.should have thought to query the button's properties but it hadn't cross my mind to think of the legend as an object with any properties at all.what kind of graphics object is this?subclass of axes?
 
User avatar
spmacdonald
Posts: 0
Joined: February 18th, 2008, 5:42 pm

Matlab wandering legend

August 2nd, 2008, 8:56 pm

I believe it is an Annotation object. Checkout HGgroup in the documentation for details. Also the 'Controlling Legends' page is useful.Matlab's documentation is awesome, it is one of the things that makes its high price tolerable.