Fix line plotting when NaN is first element in vector