[Scilab-users] xpoly()

Samuel Gougeon sgougeon at free.fr
Thu Nov 20 23:58:29 CET 2014


Hello,

Le 19/11/2014 18:39, Stefan Du Rietz a écrit :
> Hello,
>
> I have made quite an effort to write commands in numerous sci-files 
> with the low level function xpoly() to avoid changes to the axes.
>
> But (surprise, surprise!), 

The fix of the bug 8956  has been announced in the Release Notes of 
Scilab 5.5.0 :
#8956 - xpoly, xfpoly, xrect, xsegs and xarc did not update data_bounds 
property.
http://bugzilla.scilab.org/8956
See also http://bugzilla.scilab.org/13365, fixed in 5.5.1
The new behavior has been reported as a buggy one at 
http://bugzilla.scilab.org/show_bug.cgi?id=13643
But as written in comment of that report, I fully agree with the #8656 
reporter (and duplicates ones):
The former behavior was very bad, while from the new one, it is trivial 
to get the former behavior.

As Antoine has written it, if you want to keep the data bounds 
unchanged, from Scilab  5.5.1 you just have to save the initial bounds 
(no need to copy and save the full axes!) and finally restore them:
ax = gca();
DBold = ax.data_bounds;
// Then here plot tens, hundred or thousands xpoly(), xfpolys(), 
xarcs(), xsegs(), etc...
// Finally, restore the entering bounds;
ax.data_bounds = DBold;
// and that's it!

Whereas with the former behavior, updating data bounds with an external 
script was impossible.
Reasons are somewhat detailled here: 
http://bugzilla.scilab.org/show_bug.cgi?id=13643#c2

This is why this fix and the new behavior should rather be considered as 
a big improvement, since there is no specific  Scilab function dedicated 
to bounds recalculation.
Unfortunately, replot() does not do that : 
http://help.scilab.org/docs/5.5.1/en_US/replot.html

By the way, when one plots something, it looks quite expected to be able 
to see the plotted object. It was often not the case for geometrical 
shapes with the former behavior of xpoly() and of other comparable 
plotting functions, with no way to compute relevant data bounds.

Regards
Samuel




More information about the users mailing list