[Scilab-users] datatips in multiple axes plot

P M p.muehlmann at gmail.com
Fri Oct 1 00:58:18 CEST 2021


David,

if you can express your data by a function, maybe something like this can
help?

BR
Philipp

// ##########################################
//define functions for data generationfunction res=func1(x)
    res = sin(x);endfunction
function res=func2(x)
    res = x .* x;endfunction
function res=func3(x)
    res = exp(x);endfunction

// define function for data tip callbackfunction
res=dataTipByX(fhandle, p1handle, p2handle, p3handle)

    xTip = evstr(x_mdialog('select x value','x','10'));
    y1Tip = func1(xTip);
    y2Tip = func2(xTip);
    y3Tip = func3(xTip);

    a = fhandle.children();

    sca(a(4))
    datatipRemoveAll();
    datatipCreate(p1handle,[xTip, y1Tip]);

    sca(a(3))
    datatipRemoveAll();
    datatipCreate(p2handle,[xTip, y2Tip]);

    sca(a(2))
    datatipRemoveAll();
    datatipCreate(p3handle,[xTip, y3Tip]);

    res = 0;
    endfunction
// create datax= linspace(-100,100,100);y1 = func1(x);y2 = func2(x);y3
= func3(x);
// create figure with plotsf = figure();
plot(x,y1);a1 = gca();e1 = gce();p1 = e1.children();
newaxes()plot(x,y2);a2 = gca();e2 = gce();p2 = e2.children();
newaxes()plot(x,y3);a3 = gca();e3 = gce();p3 = e3.children();
m1=uimenu(f,'label', 'DataTip', 'callback', "dataTipByX(f, p1, p2, p3)");
// do some figure editingf.background = 8;
a2.filled = 'off';a3.filled = 'off';
a2.y_location = "middle"a3.y_location = "right"
a3.log_flags = "nln"
p1.thickness = 1;p2.thickness = 1;p3.thickness = 1;
p2.foreground = 1;p3.foreground = 5;
// ##########################################



Am Do., 30. Sept. 2021 um 13:15 Uhr schrieb Stéphane Mottelet <
stephane.mottelet at utc.fr>:

> Hello,
>
> Having digged in the code of the entity picker some time ago, I think that
> the problem  can be fixed at the Java level. Please create an issue on
> Bugzilla.
>
> S.
>
> Le 30 sept. 2021 à 13:10, CRETE Denis <denis.crete at thalesgroup.com> a
> écrit :
>
> 
>
> Hello,
>
> I tried to use the example of “newaxes” in the help files, but I can’t
> create any datatip (because of frames ???)…
>
> With the example of “sca” in the help files, I can create datatips on all
> 3 curves (distributed on 2 different sets of axes). In this case, the
> subplots do not overlap.
>
> If the axes_bounds vectors are changed to [0,0,1,1] for both sets of axes,
> so that now they overlap, then I could not create datatips anymore.
>
>
>
> If you are looking for a workaround, then changing the order of the axes
> may be a solution. It should be possible to implement it by a new menu
> button created with uimenu (and as many submenus as the number of axes -1),
> each with a callback like “swap_handles(axes_1, axes_n)”.
>
> HTH
>
> Denis
>
>
>
> *De :* users <users-bounces at lists.scilab.org> *De la part de* CHEZE David
> 227480
> *Envoyé :* jeudi 30 septembre 2021 09:57
> *À :* Users mailing list for Scilab <users at lists.scilab.org>
> *Objet :* [Scilab-users] datatips in multiple axes plot
>
>
>
> Dear all,
>
>
>
> I found a limitation in the datatip manager of any figure window, as
> illustrated in the screen capture below, from the “multiple scaled plots”
> example : the datatip manager can catch only the last axe that was plotted,
> in the example only the red curve. This is a pity since it might be needed
> to ask datatip for other curves as well when analysing experimental data
> for instance.
>
> I tried to set first axe as the current axes, sca(gcf().children(3)), but
> I didn’t manage to get the datatips for the first black curve.
>
> Do you see any reason for this limitation? Enhancement suggestion ?
>
>
>
>
>
> David
>
>
>
> <image001.png>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20211001/bab61d64/attachment.htm>


More information about the users mailing list