[Scilab-users] Why plot doesn't work on integers

Samuel Gougeon sgougeon at free.fr
Sat Feb 2 21:29:24 CET 2019


Hello Federico,

Thanks for pointing this issue.
It is clearly a bug. It occurs since the earliest ages of Scilab.
It will be fixed ASAP.

Regards
Samuel

Le 02/02/2019 à 09:42, Federico Miyara a écrit :
>
> Dear all,
>
> I know it is better to use plot2d, but I wonder why plot works 
> differently from plot2d when one of the variables is integer.
>
> Consider this code
>
>   // Generate x axis with real (double) numbers
>   x = (1:20)/20
>
>   // Generate y axis with random integers
>   y = iconvert(100*rand(1,20),2)
>
>   // Plot y vs x
>   plot(x, y)
>
> The plot represents x vs its index, which is not the intended 
> behavior. Replacing plot(x,y) with plot2d(x,y) we get the correct plot.
>
> The documentation of both plot and plot2d requires "real" matrix or 
> vector. It seems that plot takes it a bit too literally (as a data 
> type) while plot2d adheres to the mathematical meaning of "real" 
> (considering integer numbers as a subset of real numbers).
>
> Is there a fundamental reason for this?
>
> The problem arises when one retrieves integers from a file without 
> converting them to double (which requires much more memory).
>
> Regards,
>
> Federico Miyara
>
>
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> 
> 	Libre de virus. www.avast.com 
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> 
>
>
> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
>
> _______________________________________________
> 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/20190202/fa9fa671/attachment.htm>


More information about the users mailing list