# Plot over line gives NaN

**URL:** https://discourse.paraview.org/t/plot-over-line-gives-nan/2207
**Category:** ParaView Support
**Created:** [July 12, 2019, 3:19pm UTC](https://discourse.paraview.org/t/plot-over-line-gives-nan/2207 "2019-07-12T15:19:46Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![Rem](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/5fc32e/32.png) [@Rem](https://discourse.paraview.org/u/Rem)
#### Post date: [July 12, 2019, 3:19pm UTC](https://discourse.paraview.org/t/plot-over-line-gives-nan/2207/1 "2019-07-12T15:19:47Z")

</div>

Hi all!

I’m experiencing a little issue here when plotting over line. When I try to visualise the attached data in 2D everything works well. But if I want to plot, say on the x=0 axis, some values don’t appear (wholes in the line) whereas they appear on the 2D visualisation.

Any idea ?

Thanks guys!  
Rem

[data.rar](https://discourse.paraview.org/uploads/default/original/2X/7/7efaf8802e7aa94bb0f7a387d6ee02892c010127.rar) (3.4 MB)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [July 15, 2019, 9:21am UTC](https://discourse.paraview.org/t/plot-over-line-gives-nan/2207/2 "2019-07-15T09:21:54Z")

</div>

It is working great here. Can you provide a step by step to reproduce the issue ?

---

<div class="post-metadata">

### Author: ![Rem](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/5fc32e/32.png) [@Rem](https://discourse.paraview.org/u/Rem)
#### Post date: [July 15, 2019, 9:28am UTC](https://discourse.paraview.org/t/plot-over-line-gives-nan/2207/3 "2019-07-15T09:28:49Z")

</div>

Okay:  
1- plot over line  
2- set the line on the y axis  
3- set the x coordinates of both ends to 0  
4- apply  
On the new window you should see a plot.

 ![image](https://discourse.paraview.org/uploads/default/original/2X/7/73c4cecc45648ab49e0ec284186d5e36cc448bcb.png)  
Now see that the line has 2 holes (that shouldn’t be there…)  
5- export the data to .csv and you should see NaN values

Also note that these “holes” disappear if you set the x position of the line on -1e-9 for example.

 ![image](https://discourse.paraview.org/uploads/default/original/2X/2/27d584604ceafe8722d02872a617e729fbdffa8a.png)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [July 15, 2019, 9:33am UTC](https://discourse.paraview.org/t/plot-over-line-gives-nan/2207/4 "2019-07-15T09:33:33Z")

</div>

that a problem when the line is exactly on the edge. I would suggest using “Ctrl+P” to find the right position for the line?.

---

<div class="post-metadata">

### Author: ![Rem](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/5fc32e/32.png) [@Rem](https://discourse.paraview.org/u/Rem)
#### Post date: [July 15, 2019, 9:39am UTC](https://discourse.paraview.org/t/plot-over-line-gives-nan/2207/5 "2019-07-15T09:39:08Z")

</div>

Tried that, but it crashed for some reason

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [July 15, 2019, 9:40am UTC](https://discourse.paraview.org/t/plot-over-line-gives-nan/2207/6 "2019-07-15T09:40:05Z")

</div>

Looks like a bug. does 5.7.0-RC1 fixes it ?

---

<div class="post-metadata">

### Author: ![Rem](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/5fc32e/32.png) [@Rem](https://discourse.paraview.org/u/Rem)
#### Post date: [July 15, 2019, 9:40am UTC](https://discourse.paraview.org/t/plot-over-line-gives-nan/2207/7 "2019-07-15T09:40:31Z")

</div>

Unfortunately not

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [July 15, 2019, 9:48am UTC](https://discourse.paraview.org/t/plot-over-line-gives-nan/2207/8 "2019-07-15T09:48:01Z")

</div>

Any output in the terminal ?

---

<div class="post-metadata">

### Author: ![Rem](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/5fc32e/32.png) [@Rem](https://discourse.paraview.org/u/Rem)
#### Post date: [July 15, 2019, 9:49am UTC](https://discourse.paraview.org/t/plot-over-line-gives-nan/2207/9 "2019-07-15T09:49:21Z")

</div>

None

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [July 15, 2019, 9:51am UTC](https://discourse.paraview.org/t/plot-over-line-gives-nan/2207/10 "2019-07-15T09:51:45Z")

</div>

Well, unless you can provide more info, you will have to carefully set your line position.

---

<div class="post-metadata">

### Author: ![Rem](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/5fc32e/32.png) [@Rem](https://discourse.paraview.org/u/Rem)
#### Post date: [July 15, 2019, 9:52am UTC](https://discourse.paraview.org/t/plot-over-line-gives-nan/2207/11 "2019-07-15T09:52:51Z")

</div>

I’m afraid I can’t. Now that I found a workaround it’s okay but this is a mystery to me. Have you managed to reproduce it ?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [July 15, 2019, 9:59am UTC](https://discourse.paraview.org/t/plot-over-line-gives-nan/2207/12 "2019-07-15T09:59:07Z")

</div>

Not at all. If you want to investigate the issue yourself, you will have to build ParaView in debug and run it with a debugger. Not an easy task unless you are a programmer.

---

<div class="post-metadata">

### Author: ![Rem](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/5fc32e/32.png) [@Rem](https://discourse.paraview.org/u/Rem)
#### Post date: [July 15, 2019, 10:01am UTC](https://discourse.paraview.org/t/plot-over-line-gives-nan/2207/13 "2019-07-15T10:01:05Z")

</div>

That’s strange cause the same thing happens on two of my computers.  
I’ll see if I can find time to investigate a bit further though

---

<div class="post-metadata">

### Author: ![wascott](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/w/8e8cbc/32.png) [@wascott](https://discourse.paraview.org/u/wascott)
#### Post date: [July 16, 2019, 7:23pm UTC](https://discourse.paraview.org/t/plot-over-line-gives-nan/2207/14 "2019-07-16T19:23:58Z")

</div>

Remi, if you can post your data in a different format, such as a .tar.gz, I will take a look.  
Alan

---

<div class="post-metadata">

### Author: ![Rem](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/5fc32e/32.png) [@Rem](https://discourse.paraview.org/u/Rem)
#### Post date: [July 17, 2019, 6:52am UTC](https://discourse.paraview.org/t/plot-over-line-gives-nan/2207/15 "2019-07-17T06:52:48Z")

</div>

Hi,  
What about that ?  
[temperature.xdmf](https://discourse.paraview.org/uploads/default/original/2X/2/268e0e5e018e1de53f165da0be2c1dec14d67139.xdmf) (681 Bytes)  
[temperature.h5](https://discourse.paraview.org/uploads/default/original/2X/8/8244e3144df8df017d95b9e0fa67fcc3d9188738.h5) (379.3 KB)

Same thing happens on this data.

 ![image](https://discourse.paraview.org/uploads/default/original/2X/b/badc970481bfb2fa90930f00a546e739b632b770.png)

---

<div class="post-metadata">

### Author: ![Kenneth\_Moreland](https://discourse.paraview.org/user_avatar/discourse.paraview.org/kenneth_moreland/32/15033_2.png) [@Kenneth\_Moreland](https://discourse.paraview.org/u/Kenneth_Moreland)
#### Post date: [July 17, 2019, 2:12pm UTC](https://discourse.paraview.org/t/plot-over-line-gives-nan/2207/16 "2019-07-17T14:12:09Z")

</div>

The problem is that you are trying to plot right on the edge of your mesh, and numerical inaccuracies are causing points of the line to be outside of your mesh. (This is not a criticism of your data. Rather, this is just the nature of floating point numbers on a computer.)

 ![Capture](https://discourse.paraview.org/uploads/default/original/2X/b/be8a01f64d569506de4f90eddf12ee55592c2078.png)

Take a look at this captured screenshot. Here I have zoomed in the mesh at one of the places where the `Plot Over Line` is giving a NaN value. (It is the topmost point in the mesh and the rightmost point in the plot.) Then I have selected 3 mesh points around that location and I’m showing the numeric information for those 3 points in the superimposed `Find Data` dialog.

You can see that although the points with ids 387 and 713 have an x coordinate value of 0. However, the point with id 8 (which happens to be in the middle) has x coordinate value of -1.71663e-16. This is just slightly to the left of the line you are plotting on. The difference is imperceptible and I’m sure below any realistic significant digits. However, it means that when `Plot Over Line` intersects the line around those mesh cells, it computes it as just outside the boundary of the mesh, and thus assigns NaN values (which is the correct behavior).

The solution is simple. Move the line to the left by an epsilon amount so that it is always inside the mesh. I changed the x coordinate of both `Point 1` and `Point 2` to be `-1e-15`, and that seemed to work just fine as shown in this second screen capture.

 ![Capture-fixed](https://discourse.paraview.org/uploads/default/original/2X/0/0f1b323703fa0679e3f883679d55b8d8aed63dc4.png)

---

<div class="post-metadata">

### Author: ![Rem](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/5fc32e/32.png) [@Rem](https://discourse.paraview.org/u/Rem)
#### Post date: [July 17, 2019, 2:15pm UTC](https://discourse.paraview.org/t/plot-over-line-gives-nan/2207/17 "2019-07-17T14:15:51Z")

</div>

Hi Kenneth ! Thanks for the help ! I was starting to imagine that the reason was something like that. I’ll find a solution for a better meshing.  
I found that trick of moving an epsilon to the left but couldn’t figure why it worked: now I do!

Thank you all !!

Rem
