%% Minimal example code from https://groups.google.com/d/msg/comp.text.tex/k9_gq6h0tbc/7vi1GfXlAQAJ by user Gudrun
\documentclass{article}
\usepackage{gnuplot-lua-tikz}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{\gpbboxborder}
\begin{document}
\begin{tikzpicture}[gnuplot]
%% generated with GNUPLOT 5.0p1 (Lua 5.2; terminal rev. 99, script rev. 100)
%% Fri Sep 11 09:10:43 2015
\tikzset{every node/.append
style={font={\rmfamily\fontsize{12pt}{14.4pt}\selectfont}}}
\path (0.000,0.000) rectangle (12.035,8.013);
\gpcolor{color=gp lt color border}
\gpsetlinetype{gp lt border}
\gpsetdashtype{gp dt solid}
\gpsetlinewidth{1.00}
\draw[gp path] (1.430,0.740)--(1.610,0.740);
\draw[gp path] (11.372,0.740)--(11.192,0.740);
\node[gp node right,font={\rmfamily\fontsize{12pt}{14.4pt}\selectfont}]
at (1.210,0.740) {$-1$};
\draw[gp path] (1.430,1.423)--(1.610,1.423);
\draw[gp path] (11.372,1.423)--(11.192,1.423);
\node[gp node right,font={\rmfamily\fontsize{12pt}{14.4pt}\selectfont}]
at (1.210,1.423) {$-0.8$};
\draw[gp path] (1.430,2.106)--(1.610,2.106);
\draw[gp path] (11.372,2.106)--(11.192,2.106);
\node[gp node right,font={\rmfamily\fontsize{12pt}{14.4pt}\selectfont}]
at (1.210,2.106) {$-0.6$};
\draw[gp path] (1.430,2.789)--(1.610,2.789);
\draw[gp path] (11.372,2.789)--(11.192,2.789);
\node[gp node right,font={\rmfamily\fontsize{12pt}{14.4pt}\selectfont}]
at (1.210,2.789) {$-0.4$};
\draw[gp path] (1.430,3.472)--(1.610,3.472);
\draw[gp path] (11.372,3.472)--(11.192,3.472);
\node[gp node right,font={\rmfamily\fontsize{12pt}{14.4pt}\selectfont}]
at (1.210,3.472) {$-0.2$};
\draw[gp path] (1.430,4.155)--(1.610,4.155);
\draw[gp path] (11.372,4.155)--(11.192,4.155);
\node[gp node right,font={\rmfamily\fontsize{12pt}{14.4pt}\selectfont}]
at (1.210,4.155) {$0$};
\draw[gp path] (1.430,4.838)--(1.610,4.838);
\draw[gp path] (11.372,4.838)--(11.192,4.838);
\node[gp node right,font={\rmfamily\fontsize{12pt}{14.4pt}\selectfont}]
at (1.210,4.838) {$0.2$};
\draw[gp path] (1.430,5.521)--(1.610,5.521);
\draw[gp path] (11.372,5.521)--(11.192,5.521);
\node[gp node right,font={\rmfamily\fontsize{12pt}{14.4pt}\selectfont}]
at (1.210,5.521) {$0.4$};
\draw[gp path] (1.430,6.204)--(1.610,6.204);
\draw[gp path] (11.372,6.204)--(11.192,6.204);
\node[gp node right,font={\rmfamily\fontsize{12pt}{14.4pt}\selectfont}]
at (1.210,6.204) {$0.6$};
\draw[gp path] (1.430,6.887)--(1.610,6.887);
\draw[gp path] (11.372,6.887)--(11.192,6.887);
\node[gp node right,font={\rmfamily\fontsize{12pt}{14.4pt}\selectfont}]
at (1.210,6.887) {$0.8$};
\draw[gp path] (1.430,7.570)--(1.610,7.570);
\draw[gp path] (11.372,7.570)--(11.192,7.570);
\node[gp node right,font={\rmfamily\fontsize{12pt}{14.4pt}\selectfont}]
at (1.210,7.570) {$1$};
\draw[gp path] (1.430,0.740)--(1.430,0.920);
\draw[gp path] (1.430,7.570)--(1.430,7.390);
\node[gp node center,font={\rmfamily\fontsize{12pt}{14.4pt}\selectfont}]
at (1.430,0.371) {$-10$};
\draw[gp path] (3.916,0.740)--(3.916,0.920);
\draw[gp path] (3.916,7.570)--(3.916,7.390);
\node[gp node center,font={\rmfamily\fontsize{12pt}{14.4pt}\selectfont}]
at (3.916,0.371) {$-5$};
\draw[gp path] (6.401,0.740)--(6.401,0.920);
\draw[gp path] (6.401,7.570)--(6.401,7.390);
\node[gp node center,font={\rmfamily\fontsize{12pt}{14.4pt}\selectfont}]
at (6.401,0.371) {$0$};
\draw[gp path] (8.887,0.740)--(8.887,0.920);
\draw[gp path] (8.887,7.570)--(8.887,7.390);
\node[gp node center,font={\rmfamily\fontsize{12pt}{14.4pt}\selectfont}]
at (8.887,0.371) {$5$};
\draw[gp path] (11.372,0.740)--(11.372,0.920);
\draw[gp path] (11.372,7.570)--(11.372,7.390);
\node[gp node center,font={\rmfamily\fontsize{12pt}{14.4pt}\selectfont}]
at (11.372,0.371) {$10$};
\draw[gp path]
(1.430,7.570)--(1.430,0.740)--(11.372,0.740)--(11.372,7.570)--cycle;
\node[gp node right,font={\rmfamily\fontsize{12pt}{14.4pt}\selectfont}]
at (9.652,7.205) {f(x)};
\gpcolor{rgb color={0.690,0.188,0.376}}
\gpsetlinewidth{2.00}
\draw[gp path] (9.872,7.205)--(10.932,7.205);
\draw[gp path]
(1.430,6.013)--(1.530,5.400)--(1.631,4.737)--(1.731,4.050)--(1.832,3.367)%
--(1.932,2.716)--(2.033,2.124)--(2.133,1.615)--(2.233,1.208)--(2.334,0.922)--(2.434,0.767)%
--(2.535,0.750)--(2.635,0.871)--(2.736,1.126)--(2.836,1.504)--(2.936,1.990)--(3.037,2.564)%
--(3.137,3.203)--(3.238,3.881)--(3.338,4.569)--(3.438,5.241)--(3.539,5.868)--(3.639,6.426)%
--(3.740,6.892)--(3.840,7.246)--(3.941,7.474)--(4.041,7.568)--(4.141,7.523)--(4.242,7.340)%
--(4.342,7.028)--(4.443,6.600)--(4.543,6.071)--(4.644,5.465)--(4.744,4.806)--(4.844,4.120)%
--(4.945,3.435)--(5.045,2.780)--(5.146,2.181)--(5.246,1.662)--(5.347,1.244)--(5.447,0.945)%
--(5.547,0.777)--(5.648,0.745)--(5.748,0.853)--(5.849,1.095)--(5.949,1.461)--(6.050,1.937)%
--(6.150,2.503)--(6.250,3.136)--(6.351,3.811)--(6.451,4.499)--(6.552,5.174)--(6.652,5.807)%
--(6.752,6.373)--(6.853,6.849)--(6.953,7.215)--(7.054,7.457)--(7.154,7.565)--(7.255,7.533)%
--(7.355,7.365)--(7.455,7.066)--(7.556,6.648)--(7.656,6.129)--(7.757,5.530)--(7.857,4.875)%
--(7.958,4.190)--(8.058,3.504)--(8.158,2.845)--(8.259,2.239)--(8.359,1.710)--(8.460,1.282)%
--(8.560,0.970)--(8.661,0.787)--(8.761,0.742)--(8.861,0.836)--(8.962,1.064)--(9.062,1.418)%
--(9.163,1.884)--(9.263,2.442)--(9.364,3.069)--(9.464,3.741)--(9.564,4.429)--(9.665,5.107)%
--(9.765,5.746)--(9.866,6.320)--(9.966,6.806)--(10.066,7.184)--(10.167,7.439)--(10.267,7.560)%
--(10.368,7.543)--(10.468,7.388)--(10.569,7.102)--(10.669,6.695)--(10.769,6.186)--(10.870,5.594)%
--(10.970,4.943)--(11.071,4.260)--(11.171,3.573)--(11.272,2.910)--(11.372,2.297);
\gpcolor{color=gp lt color border}
\gpsetlinewidth{1.00}
\draw[gp path]
(1.430,7.570)--(1.430,0.740)--(11.372,0.740)--(11.372,7.570)--cycle;
%% coordinates of the plot area
\gpdefrectangularnode{gp plot
1}{\pgfpoint{1.430cm}{0.740cm}}{\pgfpoint{11.372cm}{7.570cm}}
\end{tikzpicture}
%% gnuplot variables
\end{document}