# Inconsistent results when using plot2d with %nan values

**URL:** <https://scilab.discourse.group/t/inconsistent-results-when-using-plot2d-with-nan-values/482>\
**Category:** Graphics and plotting\
**Created:** [April 23, 2024, 2:03pm UTC](https://scilab.discourse.group/t/inconsistent-results-when-using-plot2d-with-nan-values/482 "2024-04-23T14:03:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdresser](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@mdresser](https://scilab.discourse.group/u/mdresser)\
**Post date:** [April 23, 2024, 2:03pm UTC](https://scilab.discourse.group/t/inconsistent-results-when-using-plot2d-with-nan-values/482/1 "2024-04-23T14:03:44Z")

</div>

I have two PCs which both run Ubuntu 20.04 and Scilab 2024.0.0. I run the same script on the same data on both and get different plots from data with %nan values. The desired results from plot2d are that %nan values are not plotted. (I would provide example but new users are only allowed one embedded media.)

One of the PCs works perfectly but one of the PCs produces this:

 ![badplot](https://global.discourse-cdn.com/free1/uploads/utc/original/1X/b602dffb55736dfeb814e5189476ff37e12c2ecc.png)  
%nan values are plotted in the middle of the plot

I must be missing something but can’t see it?  
Mark

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [April 23, 2024, 2:46pm UTC](https://scilab.discourse.group/t/inconsistent-results-when-using-plot2d-with-nan-values/482/2 "2024-04-23T14:46:03Z")

</div>

Hello,

Please give a short piece of code which exhibits the problem.

S.

---

<div class="post-metadata">

**Author:** ![mdresser](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@mdresser](https://scilab.discourse.group/u/mdresser)\
**Post date:** [April 23, 2024, 3:52pm UTC](https://scilab.discourse.group/t/inconsistent-results-when-using-plot2d-with-nan-values/482/3 "2024-04-23T15:52:37Z")

</div>

Here is an example:

```auto
mode(0);
clear;
funcprot(0);

xa = [%nan,0,0,0,0,%nan,1,1,1,1,%nan,2,2,2,2,%nan,3,3,3,3,%nan,4,4,4,4,%nan]';

xmax = max(xa);
xmin = min(xa);

close(winsid()); //be sure that any existing figure is deleted

tdlimits = [1,xmin,size(xa,1),xmax];
plot2d(xa, rect=tdlimits);        

```

The desired case is ploted as stair steps, the bad case looks like diagonal bow ties.

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [April 30, 2024, 3:54pm UTC](https://scilab.discourse.group/t/inconsistent-results-when-using-plot2d-with-nan-values/482/4 "2024-04-30T15:54:46Z")

</div>

Hello,

Here is what I get under macOS:  
 ![st](https://global.discourse-cdn.com/free1/uploads/utc/original/1X/6717bd9d864a691c6b34e45210c75f7aa74344ac.svg)

---

<div class="post-metadata">

**Author:** ![mdresser](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@mdresser](https://scilab.discourse.group/u/mdresser)\
**Post date:** [April 30, 2024, 7:31pm UTC](https://scilab.discourse.group/t/inconsistent-results-when-using-plot2d-with-nan-values/482/5 "2024-04-30T19:31:19Z")

</div>

That is exactly what I see with Windows and one of my Linux machines. The other Linux machine, which is running the same version of the OS and Scilab, shows diagonal lines connecting the ends of each horizontal line to the center of the plot. I can only assume that there is some dependency in Linux that differs between the two systems but I don’t know how to get a list of dependencies to check.

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [May 2, 2024, 11:36am UTC](https://scilab.discourse.group/t/inconsistent-results-when-using-plot2d-with-nan-values/482/6 "2024-05-02T11:36:34Z")

</div>

> [@mdresser](#):
>
> list of dependencies to check

Hello, I suggest to check the Java Virtual Machine version and vendor.

S.
