There are a number of ways to take care of those NaN values. One of the simplest workarounds is to linearly interpolate between valid x values. If no interpolation method is specified, repnan interpolates linearly: