[Scilab-users] Legends of saved SciLab graphs slip away

Samuel Gougeon sgougeon at free.fr
Tue Jun 5 13:05:13 CEST 2018


Hello Denis,

I am not able to reproduce the behavior that you describe, neither with 
6.0.0 nor with 6.0.1 on Windows7 64 bits:

g_test=scf();
x=-1:0.01:1; y=sin(2*%pi*x); z=cos(2*%pi*x);
plot2d(x',[y;z]',style=1:2)
legends(['Sin','Cos'],1:2,"ur")   // with an _s_, as in your post
twinkle(gcf().children(1))
save("fig0.dat","g_test")

xdel(gcf().figure_id)
load fig0.dat
twinkle(gcf().children(1))

The legend is correctly restored, at the expected position, with the 
expected filled property set to "on", with its handle at the expected 
first position among figure's children.

I did not try yet on Linux.

Regards
Samuel

Le 05/06/2018 à 12:15, CRETE Denis a écrit :
>
> Hello,
>
> I noticed that saving graphs with legends was not reliable. Loading 
> the graph in exactly the same environment results in a figure without 
> readable legend. More specifically, the legend is almost always stowed 
> in the upper left corner of the window, with all its components 
> stacked on top of each other.
>
> In addition, even if the legend is initially in the top axis level 
> “Axis(1)”, after loading it appears in the tree in “Axis(2)”, i.e. 
> behind the graph. So that moving back the legend to its original (X,Y) 
> position does not allow to see it until gcf().children(1).filled=”off” 
> is issued.
>
> Moving the legend using the “Axis properties” window is somehow 
> possible by changing the “Data bounds” fields of the “Axis Options”, 
> but it is hard to tell what is the effect of the variable in each 
> field. In addition, the units are not linked to anything relevant 
> (always 0 for the first field and 0.001 for the second field ? same 
> for X and Y). It looks like in general only the difference between the 
> second field and the first field matters.
>
> g_test=scf();
>
> x=-1:0.01:1; y=sin(2*%pi*x); z=cos(2*%pi*x);
>
> plot2d(x',[y;z]',style=1:2)
>
> legends(['Sin','Cos'],1:2,"ur")
>
> // Now, I save the figure in a file,
>
> // clear it,
>
> // and load it again, to notice that the legend escaped from its 
> original place, not being able to read it.
>
> // Legend recovery:
>
> g_test.children(1).filled="off";
>
> // and then it may be necessary to play with the “Data Bounds” of 
> Axis(2), X or Y (or both).
>
> I am using SciLab 6.0.0 (64 bits) on Windows 7 and a more recent 
> version on Linux (64 bits), and both show this behavior. With SciLab 
> 5.5.0 on Windows 7, after loading the figure, the legend slips away as 
> well, but it is still in Axis(1); thus, 
> g_test.children(1).filled="off" is not necessary. And moving back the 
> legend to its original position is achieved by setting the Data Bounds 
> to 0 and 0.001 on both X and Y axes.
>
> .
>
> This behaviour looks so strange to me that I have spent a lot of time 
> trying to figure out how to avoid it… without success.
>
> Best regards
>
> Denis
>
> [@@ THALES GROUP INTERNAL @@]
>
> Unité Mixte de Physique CNRS / THALES
>
> 1 Avenue Augustin Fresnel
>
> 91767 Palaiseau CEDEx - France
>
> Tel : +33 (0)1 69 41 58 52 Fax : +33 (0)1 69 41 58 78
>
> e-mail :
>
> denis.crete at thalesgroup.com <mailto:denis.crete at thalesgroup.com> 
> <mailto:%20denis.crete at thalesgroup.com>
>
> http://www.trt.thalesgroup.com/ump-cnrs-thales
>
> http://www.research.thalesgroup.com
>
>
>
> _______________________________________________
> 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/20180605/5e80427d/attachment.htm>


More information about the users mailing list