I have a time series with several large data gaps. I would like to see a connecting line between data points that are less than an hour apart, but not if the gap is larger. The accepted answer to the question, [Put a gap/break in a line plot](https://stackoverflow.com/questions/15652503/put-a-gap-break-in-a-line-plot), would work except that you sacrifice the masked points. I would like to avoid that.

I have attempted to make a list comprehension that would insert NaNs into the array, I think that would automatically achieve the same result, but I don't seem to be able to do it correctly. The best I have found is as follows:

```
import datetime as dtm
import numpy    as np

x = np.array([dtm.datetime(2001,4,3,0,47,30),dtm.datetime(2001,4,3,0,52,30),dtm.datetime(2001,4,3,0,57,30),dtm.datetime(2001,4,3,3,57,30),dtm.datetime(2001,4,3,4,2,30),dtm.datetime(2001,4,3,4,7,30)])

xmod = np.array([x[0]]+[dt1 if dt1-dt0 < dtm.timedelta(hours=1.) else [dt1,np.nan] for dt1, dt0 in zip(x[1:],x[:-1])])

```

This gives the result:

```
In [7]: xmod
Out[7]: 
   array([datetime.datetime(2001, 4, 3, 0, 47, 30),
   datetime.datetime(2001, 4, 3, 0, 47, 30),
   datetime.datetime(2001, 4, 3, 0, 52, 30),
   [datetime.datetime(2001, 4, 3, 0, 57, 30), nan],
   datetime.datetime(2001, 4, 3, 3, 57, 30),
   datetime.datetime(2001, 4, 3, 4, 2, 30)], dtype=object)

```

I have not been able to find a way to insert both the data point and the np.nan without putting brackets around them. Is this possible? Is there a better way to achieve my goal? Thanks!