\documentclass{book}
\usepackage{tikz}
\usepackage{pgfplotstable}
\usepackage{pgfplots}
\usepackage{graphicx}
\usepgfplotslibrary{units}
\usetikzlibrary{spy}
%%\usetikzlibrary{shapes.geometric} use for ellipse spy
\usetikzlibrary{shapes.geometric}
\pagestyle{empty}
\begin{document}

\begin{figure}[!b]
\begin{tikzpicture}
\newcommand{\y}{6};
\newcommand{\x}{9};
% \draw[xstep=1,ystep=0.1,very thin,color=gray] (0,0) grid (7,7);
%\draw[xstep=1,ystep=1,very thin,color=gray] (0,0) grid (7,7);
\begin{axis}[
%xlabel near ticks,
%ylabel near ticks,
xlabel style={yshift=.2cm},
ylabel style={yshift=-.5cm},
width=\x cm, height=\y cm, % size of the image
  xlabel=\fontsize{8}{6}\selectfont Phase current,
  ylabel=\fontsize{8}{6}\selectfont Phase flux linkage,
  x unit={A},
  y unit={wb-turn},
   xmin=0,xmax=18,
   ymin=0,ymax=1,
    grid = major,
    grid style={dashed, gray!30!yellow!70},
    /pgfplots/xtick={0,2,...,18},% make x steps of length=2
    /pgfplots/ytick={0,0.1,...,1.1},% make y steps of length=0.1
                yticklabel style = {font=\fontsize{8}{6}\selectfont ,xshift=0ex},
                xticklabel style = {font=\fontsize{8}{6}\selectfont ,yshift=0ex},
line width=0.03cm,
tick align=inside,
colormap/hot,
  ]  
\addplot[no marks,green] table [y=$Q_A$, x=P]{data1.txt}; 
\end{axis}
\end{tikzpicture}
\caption{Measured flux linkage}
\label{f2}
\end{figure}
\end{document}