# Joining only particular dates with DateListPlot

I have the following datasets:

dataset1={{{1997}, 98/79}, {{1998}, 26/61}, {{1999}, 22/15}, {{2000}, 100/
63}, {{2007}, 284/57}, {{2008}, 226/31}, {{2009}, 15/4}, {{2010},
221/63}};

dataset2={{{1997}, 25/79}, {{1998}, 17/61}, {{1999}, 28/25}, {{2000}, 20/
21}, {{2007}, 106/57}, {{2008}, 128/31}, {{2009}, 59/16}, {{2010},
32/9}};


I want to plot them using DateListPlot[{dataset1,dataset2}] (plus appropriate additions, such as Joined, etc.). Note, however, that there is a missing gap here: the years 2001 through 2006. I have multiple datasets (over five of them) so the dots can be hard to understand. If I use the Filling->Bottom addition, it cleans it up a bit, but still a bit hard. If I use Joined->true, it just connects 2000 and 2007 (as it should) but this implies data that I don't have.

Is there a way, using Mathematica, to connect the points for the years 1997 through 2000 and the years 2007 through 2010 - but not to draw a line in the middle between 2000 and 2007, as that skews the data?

-

Add in a Null data point to each series like this:

dataset1 = {{{1997}, 98/79}, {{1998}, 26/61}, {{1999},
22/15}, {{2000}, 100/63}, {{2001}, Null}, {{2007},
284/57}, {{2008}, 226/31}, {{2009}, 15/4}, {{2010}, 221/63}};

dataset2 = {{{1997}, 25/79}, {{1998}, 17/61}, {{1999},
28/25}, {{2000}, 20/21}, {{2001}, Null}, {{2007},
106/57}, {{2008}, 128/31}, {{2009}, 59/16}, {{2010}, 32/9}};


The plot then becomes:

DateListPlot[{dataset1, dataset2}, Joined -> True]


-
Do you know if this works in general for, say ListPlot? –  tkott Apr 19 '12 at 20:49
@tkott Yes, it does. –  Sjoerd C. de Vries Apr 19 '12 at 20:52
You could add a function like this parseList[list_, threshold_] := Module[{tag}, Reap[ Fold[(If[Abs@DateDifference[First@#2, First@#1] > threshold, Sow[{First@#1, Null}, tag]]; Sow[#2, tag]) &, First@list, Rest@list], tag][[2 , 1]]] to parse the list, where threshold is given in days –  Rojo Apr 19 '12 at 21:17
unrelated, but looking at the plot above I want to remind everybody about the option GridLines->False, which together with Frame->{True,True,False,False}, allow Edward Tufte to sleep at night. –  Michael Stern Apr 20 '12 at 16:08