fix "NaN-memory" bug when curves end in a NaN/Inf

For example,

    julia> x = [1,2,3,4,NaN]
    julia> plot(x)
    julia> plot(x)

only plots the points (2,3,4).