[Tex/LaTex] Generating Plot in Tikz from Text File

plottikz-pgf

I am trying to learn how to generate a plot given coordinates specificied in a text file, for example, the latex code in:

https://github.com/daleroberts/obstacle-problem/blob/master/figures/fig1.tex

refers to the text file:

https://github.com/daleroberts/obstacle-problem/blob/master/figures/obstacle1d-0.table

but I'm not quite sure how to get this working on my own latex environment, it doesn't seem to read in the coordinates from the text file. Is it a directory issue or do I need to add something to the code?

Here is a PGFPLOTS solution:

The files fig1.tex, obstacle1d-0.table and obstacle1d-1.table are in the same folder.

\documentclass[border=10pt]{standalone}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
domain=-1:1,
xmin=-1.6, xmax=1.6,
ymin=-0.6, ymax=1.2,
axis lines=center,
axis equal image,
xlabel=$x$,
]
node[right] {$g(x)$};
node[above right] {$v(x)$};