[Scilab-users] axis number style => axes.ticks_format

Samuel Gougeon sgougeon at free.fr
Sun Jan 31 07:23:51 CET 2021


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20210131/8aa42f8b/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bbjmenbikokllhgm.png
Type: image/png
Size: 5178 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20210131/8aa42f8b/attachment.png>


More information about the users mailing list