Hello,
For graphic window with a large number of curves, the problem is in displaying
legends: using the legend function, the last entries are not visible.
The solution I am trying to code is the following:
First split the legends in 2 columns with approximately the same number of
entries for each column.
After placing the first column on the graphics, automatically place the 2nd
column side by side with the first one,
i.e. at a position which depends on the length of the strings in the first
column, using move.
xstringl gives the length of one of the legends: PROBLEM = it is approximate
and most probably not the easiest way...
nc=40;
names_legend='legend_'+string(1:nc);
nc1=round(nc/2); //nc is the number of curves: split in 2
legends(names_legend(1:nc1),1:nc1,font_size=3,opt="ul");// put first column of
legends
a1=gca();
// Get the width of the text
tw=0;
for i=1:nc,
tl=xstringl(0,0,names_legend(i),a1.font_style,a1.font_size);
tw=max(tw,tl(3));
end;
legends(names_legend((nc1+1):nc),(nc1+1):nc,font_size=3,opt="ul"); // 2nd
column on top of first
move(a1.children(1),[tw*0.7513907+0.0585762,0]); //Move it horizontally (along
x-axis);
As a matter of fact, I don't know why I need to apply some linear relationship
between tw and the value of the horizontal shift... This is awkward! I am
unable to find an easy way to get the width of the box of the first column of
the legend.
Thank you for any help.
Denis
_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users