[prev in list] [next in list] [prev in thread] [next in thread] 

List:       scilab-users
Subject:    Re: [Scilab-users] axis number style => axes.ticks_format
From:       Samuel Gougeon <sgougeon () free ! fr>
Date:       2021-01-31 6:23:51
Message-ID: d786cf52-9a22-b6e2-6eb0-1a2f50920c78 () free ! fr
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hello Federico,

Le 20/08/2020 à 18:18, Federico Miyara a écrit  :
>
> Dear all,
>
> When plotting some data the axes present ticks labelled with numbers. 
> However, the digits of the different numbers on the same axis may 
> differ, for instance 0.8, 0.9, 1, 1.1. It would be better if the 
> default presentation were 0.8, 0.9, 1.0, 1.1. Is there a way to set 
> this as a default?

Yes:

--> gca().ticks_format(1) = "%.1f";

Because of the bug 14790 <http://bugzilla.scilab.org/14790>, new ticks 
labels are not rendered. But there is a work-around:


--> a = gca(); a.x_ticks.labels(1) = a.x_ticks.labels(1);

forces displaying new ticks labels.
As an expected side effect, this automatically sets a.auto_ticks(1) = 
"off", but labels are well formatted.
Example:

x  =  0:0.1:2;
plot(x,sin(5*x))
a  =  gca();  a.ticks_format(1)  =  "%.1f";
a.x_ticks.labels(1)  =  a.x_ticks.labels(1); HTH Samuel


[Attachment #5 (multipart/related)]

[Attachment #7 (text/html)]

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">Hello Federico,</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">Le 20/08/2020 Ã  18:18, Federico Miyara
      a écrit  :<br>
    </div>
    <blockquote type="cite"
      cite="mid:2b13c61a-91e2-b4c4-6464-fa00298213a2@fceia.unr.edu.ar">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <br>
      <font face="Courier New">Dear all, <br>
        <br>
        When plotting some data the axes present ticks labelled with
        numbers. However, the digits of the different numbers on the
        same axis may differ, for instance 0.8, 0.9, 1, 1.1. It would be
        better if the default presentation were 0.8, 0.9, 1.0, 1.1. Is
        there a way to set this as a default?<br>
      </font></blockquote>
    <p>Yes:<br>
    </p>
    <p><font size="+1" face="monospace">--&gt; gca().ticks_format(1) =
        "%.1f";</font></p>
    <p>Because of the <a moz-do-not-send="true"
        href="http://bugzilla.scilab.org/14790">bug 14790</a>, new ticks
      labels are not rendered. But there is a work-around:</p>
    <p><br>
      <font size="+1" face="monospace">--&gt; a = gca();
        a.x_ticks.labels(1) = a.x_ticks.labels(1);</font></p>
    <p>forces displaying new ticks labels.<br>
      As an expected side effect, this automatically sets
      a.auto_ticks(1) = "off", but labels are well formatted.<br>
      Example:</p>
    <pre style="font-family:Monospaced;font-style:normal;font-size:14.0;"><span \
style="color:rgb(0,0,0);">x</span> <span style="color:rgb(92,92,92);">=</span> <span \
style="color:rgb(188,143,143);">0</span><span \
style="color:rgb(255,170,0);">:</span><span \
style="color:rgb(188,143,143);">0.1</span><span \
style="color:rgb(255,170,0);">:</span><span \
style="color:rgb(188,143,143);">2</span><span style="color:rgb(0,0,0);">;</span> \
<span style="color:rgb(174,92,176);text-decoration:underline;">plot</span><span \
style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">x</span><span \
style="color:rgb(0,0,0);">,</span><span \
style="color:rgb(50,185,185);">sin</span><span \
style="color:rgb(74,85,219);">(</span><span \
style="color:rgb(188,143,143);">5</span><span \
style="color:rgb(92,92,92);">*</span><span style="color:rgb(0,0,0);">x</span><span \
style="color:rgb(74,85,219);">)</span><span style="color:rgb(74,85,219);">)</span> \
<span style="color:rgb(0,0,0);">a</span> <span style="color:rgb(92,92,92);">=</span> \
<span style="color:rgb(174,92,176);text-decoration:underline;">gca</span><span \
style="color:rgb(74,85,219);">(</span><span \
style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span> <span \
style="color:rgb(0,0,0);"> a</span><span style="color:rgb(92,92,92);">.</span><span \
style="color:rgb(170,170,170);">ticks_format</span><span \
style="color:rgb(74,85,219);">(</span><span \
style="color:rgb(188,143,143);">1</span><span style="color:rgb(74,85,219);">)</span> \
<span style="color:rgb(92,92,92);">=</span> <span \
style="color:rgb(188,143,143);">"</span><span \
style="color:rgb(188,143,143);">%.1f</span><span \
style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">;</span> \
<span style="color:rgb(0,0,0);">a</span><span \
style="color:rgb(92,92,92);">.</span><span \
style="color:rgb(170,170,170);">x_ticks</span><span \
style="color:rgb(92,92,92);">.</span><span \
style="color:rgb(170,170,170);">labels</span><span \
style="color:rgb(74,85,219);">(</span><span \
style="color:rgb(188,143,143);">1</span><span style="color:rgb(74,85,219);">)</span> \
<span style="color:rgb(92,92,92);">=</span> <span \
style="color:rgb(0,0,0);">a</span><span style="color:rgb(92,92,92);">.</span><span \
style="color:rgb(170,170,170);">x_ticks</span><span \
style="color:rgb(92,92,92);">.</span><span \
style="color:rgb(170,170,170);">labels</span><span \
style="color:rgb(74,85,219);">(</span><span \
style="color:rgb(188,143,143);">1</span><span \
style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;

<img src="cid:part2.B317CA56.A42D8CEF@free.fr" alt="">
HTH
Samuel

</span></pre>
  </body>
</html>


["bbjmenbikokllhgm.png" (image/png)]

_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic