<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
color:black;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman","serif";
color:black;}
pre
{mso-style-priority:99;
mso-style-link:"Préformaté HTML Car";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";
color:black;}
span.EmailStyle17
{mso-style-type:personal;
font-family:"Arial","sans-serif";
color:windowtext;}
span.PrformatHTMLCar
{mso-style-name:"Préformaté HTML Car";
mso-style-priority:99;
mso-style-link:"Préformaté HTML";
font-family:Consolas;
color:black;
mso-fareast-language:EN-US;}
span.EmailStyle21
{mso-style-type:personal-reply;
font-family:"Arial","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body bgcolor="white" lang="FR" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif";color:#1F497D">Hello,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif";color:#1F497D">Thank you for your quick answer.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif";color:#1F497D">I could get a correct behaviour with your code. However, if you run this part of the code:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">g_test=scf();<br>
x=-1:0.01:1; y=sin(2*%pi*x); z=cos(2*%pi*x);<br>
plot2d(x',[y;z]',style=1:2)<br>
legends(['Sin','Cos'],1:2,"ur") // with an _s_, as in your post<br>
twinkle(gcf().children(1))<br>
save("fig0.dat","g_test")<br>
<br>
xdel(gcf().figure_id)<br>
</span><span lang="EN-US" style="font-family:"Arial","sans-serif";color:#1F497D"> <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif";color:#1F497D">and terminate with the command:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">g_man=scf();<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif";color:#1F497D">Now from the (empty) graphic window I click on
</span><span lang="EN-US">“File”/”Load</span><span lang="EN-US" style="font-family:"Arial","sans-serif";color:#1F497D">” and type in
</span><span lang="EN-US">“*.dat”</span><span lang="EN-US" style="font-family:"Arial","sans-serif";color:#1F497D"> + select
</span><span lang="EN-US">“fig0.dat”</span><span lang="EN-US" style="font-family:"Arial","sans-serif";color:#1F497D"> then, I end up with the legend in the background (and thus invisible until I issue the console command
</span><span lang="EN-US">g_man.children(1).filled=”off”</span><span lang="EN-US" style="font-family:"Arial","sans-serif";color:#1F497D">… Note that the box is at the right location in the window; it is invisible only because it is in the background. The same
behaviour is observed both on Windows and Linux platforms. <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif";color:#1F497D"> <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif";color:#1F497D">I still could not figure out under what circumstances the legends slip away in the top left corner…<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif";color:#1F497D">Best regards<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif";color:#1F497D">Denis<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext;mso-fareast-language:FR">De :</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext;mso-fareast-language:FR"> users
[mailto:users-bounces@lists.scilab.org] <b>De la part de</b> Samuel Gougeon<br>
<b>Envoyé :</b> mardi 5 juin 2018 13:05<br>
<b>À :</b> Users mailing list for Scilab<br>
<b>Objet :</b> Re: [Scilab-users] Legends of saved SciLab graphs slip away<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Hello Denis,<br>
<br>
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:<br>
<br>
g_test=scf();<br>
x=-1:0.01:1; y=sin(2*%pi*x); z=cos(2*%pi*x);<br>
plot2d(x',[y;z]',style=1:2)<br>
legends(['Sin','Cos'],1:2,"ur") // with an _s_, as in your post<br>
twinkle(gcf().children(1))<br>
save("fig0.dat","g_test")<br>
<br>
xdel(gcf().figure_id)<br>
load fig0.dat<br>
twinkle(gcf().children(1))<br>
<br>
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.<br>
<br>
I did not try yet on Linux.<br>
<br>
Regards<br>
Samuel<br>
<br>
Le 05/06/2018 à 12:15, CRETE Denis a écrit :<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif"">Hello,</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif"">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.
</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif""> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif"">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.</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif""> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif"">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.</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif""> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif"">g_test=scf();</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="ES" style="font-family:"Arial","sans-serif"">x=-1:0.01:1; y=sin(2*%pi*x); z=cos(2*%pi*x);</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="ES" style="font-family:"Arial","sans-serif"">plot2d(x',[y;z]',style=1:2)</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif"">legends(['Sin','Cos'],1:2,"ur")</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif""> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif"">// Now, I save the figure in a file,
</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif"">// clear it,</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif"">// and load it again, to notice that the legend escaped from its original place, not being able to read it.
</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif""> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif"">// Legend recovery:</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif"">g_test.children(1).filled="off";</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif"">// and then it may be necessary to play with the “Data Bounds” of Axis(2), X or Y (or both).</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif""> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif"">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.</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif"">.</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif"">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.
</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif"">Best regards</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif"">Denis
</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial","sans-serif""> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif";mso-fareast-language:FR">[@@ THALES GROUP INTERNAL @@]</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif";mso-fareast-language:FR"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif"">Unité Mixte de Physique CNRS / THALES</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif"">1 Avenue Augustin Fresnel</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif"">91767 Palaiseau CEDEx - France</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif"">Tel : +33 (0)1 69 41 58 52 Fax : +33 (0)1 69 41 58 78
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif"">e-mail : </span>
<o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif""> <a href="mailto:denis.crete@thalesgroup.com">denis.crete@thalesgroup.com</a> <<a href="mailto:%20denis.crete@thalesgroup.com">mailto:%20denis.crete@thalesgroup.com</a>></span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif""><a href="http://www.trt.thalesgroup.com/ump-cnrs-thales">http://www.trt.thalesgroup.com/ump-cnrs-thales</a></span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif""><a href="http://www.research.thalesgroup.com">http://www.research.thalesgroup.com</a></span><o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman","serif";mso-fareast-language:FR"><br>
<br>
<br>
<o:p></o:p></span></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>users mailing list<o:p></o:p></pre>
<pre><a href="mailto:users@lists.scilab.org">users@lists.scilab.org</a><o:p></o:p></pre>
<pre><a href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a><o:p></o:p></pre>
</blockquote>
<p><o:p> </o:p></p>
</div>
</body>
</html>