Clear[f, XY,dots];
f[x_] = Cos[x];
XY= Table[{N[0.2 i Pi], N[f[0.2 i Pi]]},{i, 0, 5}] ;
dots = ListPlot[XY,PlotStyle->{PointSize[0.02]},
                DisplayFunction->Identity];
F = Plot[f[x], {x, 0,3.15},DisplayFunction->Identity]; 
Show[F, Graphics[Line[XY]],dots,
AspectRatio -> 0.5,
DisplayFunction->$DisplayFunction,
PlotLabel-> "f(x) and Linear Spline Interpolation",
AxesLabel->{"x","y    "}];
Show[ Graphics[Line[XY]],dots,
AspectRatio -> 0.5,
DisplayFunction->$DisplayFunction,
PlotLabel->"Linear Spline Interpolation",
AxesLabel->{"x","y    "}];

Clear[f, XY,dots];
f[x_] = Cos[x];
XY= Table[{N[0.1 i Pi], N[f[0.1 i Pi]]},{i, 0, 10}] ;
dots = ListPlot[XY,PlotStyle->{PointSize[0.02]},
                DisplayFunction->Identity];
F = Plot[f[x], {x, 0, 3.15},DisplayFunction->Identity]; 
txt = StringForm["f(x) and Linear Spline Interpolation"];
Show[F, Graphics[Line[XY]],dots,
AspectRatio -> 0.5,
DisplayFunction->$DisplayFunction,
PlotLabel->txt,AxesLabel->{"x","y    "}];
Show[ Graphics[Line[XY]],dots,
AspectRatio -> 0.5,
DisplayFunction->$DisplayFunction,
PlotLabel->"Linear Spline Interpolation",
AxesLabel->{"x","y    "}];

Clear[XY,dots];
f[x_] = 1 /(1+ 25x^2);
XY= Table[{0.2 i, f[0.2 i]},{i, -5, 5}] ;
dots = ListPlot[XY,PlotStyle->{PointSize[0.02]},
                DisplayFunction->Identity];
F = Plot[f[x], {x, -1,1},DisplayFunction->Identity]; 
txt = StringForm["Linear Spline Interpolation"];
Show[F, Graphics[Line[XY]],dots,
DisplayFunction->$DisplayFunction,
PlotLabel-> "f(x) and Linear Spline Interpolation",
AxesLabel->{"x","y    "}];
Show[ Graphics[Line[XY]],dots,
DisplayFunction->$DisplayFunction,
PlotLabel->txt,AxesLabel->{"x","y    "}];

Clear[XY,dots];
f[x_] = 1 /(1+ 25x^2);
XY= Table[{0.1 i, f[0.1 i]},{i, -10, 10}] ;
dots = ListPlot[XY,PlotStyle->{PointSize[0.02]},
                DisplayFunction->Identity];
F = Plot[f[x], {x, -1,1},DisplayFunction->Identity]; 
txt = StringForm["Linear Spline Interpolation"];
Show[F, Graphics[Line[XY]],dots,
DisplayFunction->$DisplayFunction,
PlotLabel-> "f(x) and Linear Spline Interpolation",
AxesLabel->{"x","y    "}];
Show[ Graphics[Line[XY]],dots,
DisplayFunction->$DisplayFunction,
PlotLabel->txt,AxesLabel->{"x","y    "}];