[Scilab-users] Format legends of a graph as a 2D table

CRETE Denis denis.crete at thalesgroup.com
Sun Feb 24 09:52:36 CET 2013


Thank you Samuel, this works great !
I added a frame around the whole table:

clf
nL = 40;   // number of Legends
Lpc = 15;  // number of Lines per column
names_legend = "legend_"+string(1:nL);
x = 0;
i = 1;
j = min([Lpc, nL]);
y0=[];
while i<=nL
//    disp(i)
    legends(names_legend(i:j), i:j, ..
        font_size=3, opt="ul");
    idL = gce();
    h=idL.children($);
    if i==1 then
        x0=h.data(1,1);
    end;
    y0=[y0;h.data(4,2)];
    move(idL, [x,0]);
    // width of this block
    w = strange(h.data(:,1));
    // masks the frame
    h.line_mode = "off";
    x = x+w; //position of next block
    i = i+Lpc;
    j = min([j+Lpc, nL]);
end;
h.data([1,4],1)=[x0;x0];
h.data([3,4],2)=min(y0)*ones(2,1);
h.fill_mode="off";
h.line_mode = "on";

Denis

De : users-bounces at lists.scilab.org [mailto:users-bounces at lists.scilab.org] De la part de Samuel Gougeon
Envoyé : samedi 23 février 2013 14:11
À : International users mailing list for Scilab.
Objet : Re: [Scilab-users] Format legends of a graph as a 2D table

Le 23/02/2013 01:54, CRETE Denis a écrit :

.../...

I do not understand why it is not equivalent to refer to f1.children(1)  or to refer to a1 ...

Thank you for your help.

Denis

The following automatically splits nL legends if blocks of Lpc lines
(if there are parasitic line-wrapping when receiving this sample,
please correct them before running it. It is ok when sending it):

clf

nL = 40;   // number of Legends

Lpc = 15;  // number of Lines per column

names_legend = "legend_"+string(1:nL);

x = 0;

i = 1;

j = min([Lpc, nL]);

while i<=nL

    disp(i)

    legends(names_legend(i:j), i:j, font_size=3, opt="ul"<

 /span><

span style="color:rgb(74,85,219);">);

    idL = gce();

    move(idL, [x,0]);

    w = strange(idL.children($).data(:,1)); // width of this block

    idL.children($).line_mode = "off";  // masks the frame

    x = x+w;    // updates the position of next block

    i = i+Lpc;

    j = min([j+Lpc, nL]);

end





[cid:image001.png at 01CE1274.AC9BA1B0]
Samuel



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20130224/94e3a5db/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 8375 bytes
Desc: image001.png
URL: <https://lists.scilab.org/pipermail/users/attachments/20130224/94e3a5db/attachment.png>


More information about the users mailing list