I'm currently plotting live data fetched from a server that's been stored in an array in a QwtPlot. When I don't have data that's been fetched from the server in a spot in the array I currently just return a value that is NaN in order to not plot anything at that point so as to not display data I don't have.

However, my problem is that when I have a point that's valid which neighbors a point that's invalid (I.e. NaN) the plot draws a line that extends infinitely upwards to connect the two of them, still seemingly thinking there's a point associated with NaN. Is there a way I can still use a line to draw my plot and connect all my points, but have any valid point that's connected to an invalid point not draw a line? Or should i go about this another way?

I've attached a screenshot of my plot for clarification.

Thanks for any help.

PlotExample.png