Hi All, 

If I have a figure with three line plots, and I only want to include the 2nd 
and 3rd lines in the legend, I see I cannot yet do this (MATLAB style) using 
JHandles: 

lines = get(gca, 'Children');
legend(lines(2:3), '2nd', '3rd'); 

By modifying the legend object itself, I've had some success in making blank 
spaces where the unwanted legend entries are (removing the triple handles in 
the legend object's children corresponding to each entry), but the remaining 
entries are not shifted into the new space and the legend box is not 
resized. 

I think the JHandle's legend.m would need modifying to recognise when it is 
passed an array of axes object children. The axes object java function 
makeLegend(names) would need changing to something like makeLegend(children, 
names) and the function's for loop when adding the children to the legend 
would need to be modified appropriately. Unfortunately I'm no java 
programmer (I couldn't even find the java source in the package?) but I 
would otherwise would have been happy to help add this myself. 

I know I can plot only the entries I want to a figure, add the legend, then 
plot the remaining lines to give a similar functionality. However, this 
doesn't work when the legend is refreshed/modified or if I need any unwanted 
lines plotting under wanted lines. This is still ok for what I currently 
need though. 

I know this is only a very minor problem - and needless to say I remain very 
impressed by the scope of JHandles. 

Do let me know if I've missed another way of doing this (similarly to what I 
had done in my previous post!) 

Many thanks 

Matt

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to