How to show "not a number" on a line plot? I have a line plot and occasionally there are NaNs that appear in the Y-axis. If I put them as zero then people will confuse that for actual zeros. If I remove them from the dataset, the visualizations look bad because there isn't enough data (there might only be 3-4 data points at a given time).
How can I effectively show line plots that have NaNs in them?
 A: Stephen Few has an article, Displaying Missing Values and Incomplete Periods
in Time Series, which discusses some possibilities such as using skipped, dashed or faded connections for missing Y values.

Those work well when the X values are at regular intervals (above) but not so well when the X values are irregular (below). The difference is whether the positions of the missing values can be inferred or not.

For irregular spaced X values, it's more appropriate to show the missing positions with some sort of marginal plot, which could be with dots (below) or with a rug plot.

A: It has been argued that a "bad" visualization is one that deceives or distorts.  A subtle form of deception in line plots is to connect successive points with line segments (or higher-order splines), because that presents a compelling but false visual representation that (a) intermediate values (not in the dataset) exist and (b) the missing points fall along those segments. 
When your purpose is to show the data, care is needed not to interpolate visually across the points having NaN values.  At the same time--again to avoid a false impression--you need some visually obvious mechanism to show the x coordinates of the missing values, without actually drawing any points.
These design constraints suggest decorating a default line plot with a rug plot.  In R, with the data in arrays x and y, it looks like this:
plot(x, y, type="l", lwd=2, main="Default R Plots")
rug(x)


The gaps in the graph clearly show where values are missing and the ticks on the "rug" at the bottom indicate exactly where they are missing (and how many values are missing).  Unfortunately, this mechanism fails to show the isolated points!
By erasing unnecessary ink, using line weight and color creatively, and posting the missing points, we can clarify this plot:

The rug has been placed outside the drawing region to make it clearer and the ticks for the missing y values are made longer and clearer than the others.
If this is too subtle, or if the objective is to draw attention to where the values are missing, you may prolong the rug plot to cover the drawing region and even draw all the data points:

For those who would like to implement and improve on this, here is the R code to produce both types of plots.
for(prominent in c(FALSE, TRUE)) {
  plot(x,y, type="n", bty="n", tck=0.025, main=ifelse(prominent, "Prominent", "Subtle"))
  abline(h=0, col="Gray")
  if(prominent) abline(v=x[is.na(y)], col="#d0202040")
  lines(x, y, lwd=2)
  if(prominent) {
    points(x, y, pch=21, bg="#d02020")
  } else {
    i <- !is.na(y)
    i <- !(c(FALSE,i[-length(i)]) | c(i[-1],FALSE))
    points(x[i], y[i], pch=21, bg="#d02020", cex=0.75)
  }
  rug(x, -0.04, col="Gray")
  rug(x[is.na(y)], -0.065, lwd=2, col="#d02020")
}

