How to plot coordinate between two xticks?

I want to plot some data using pgfplot. Here is a code I have written:

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat = 1.3}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
legend style={legend pos = north west, font=\footnotesize, draw=none},
legend cell align=left,
xtick=data,
ytick={0,5,10,...,45},
xticklabels={0,2,4,...,16,18},
every axis label={font=\footnotesize},
tick label style={font=\footnotesize},
label style={font=\footnotesize},
enlarge x limits=false,
enlarge y limits=false]
\addplot[lightgray, mark=*] table [x expr = \lineno, y = Time] {Data.dat};
\end{axis}
\end{tikzpicture}
\end{document}


The content of Data.dat file is as follows:

 Points Time
0        0
2000     1.11
4000     3.54
6000     7.35
8000     12.43
10000    18.15
12000    24.51
14000    31.52
16000    38.59
17791    45.35


As I'm new to this site, I'm not able to post the output graph. In the output graph, the last point (17791, 45.35) is wrongly plotted at x=18 and y=45.35.
So my question is: How do I make the last point plotted correctly between points x=16 and x=18?

-

The point is plotted precisely at x=17.791, y=45.35; the problem is that the label used for the last tick is wrong (you manually declared it to be 18 and this overrides the default value of 17.8); the problem is not the plotting: the problem is the way in which you place the x labels (specifically the last one).

In the following example I show one possible way to correct the situation: I let xtick=data (so now the ticks and their labels are automatically picked from the table) and used extra x ticks and extra xtick labels with an auxiliary blue grid just to show where the point corresponding to 18 really is; I also changed the mark used (the mark you used is too big, in my opinion, and could produce the impression of being located at x=18) and also used a different color just for visualization purposes. As you can see, the x-coordinate for the last point is just where it should be (a little to the left of the red vertical line drawn for x=18):

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat = 1.3}
\begin{document}
\begin{tikzpicture}[scale=1.2]
\begin{axis}[
xmax=18500,
legend style={legend pos = north west, font=\footnotesize, draw=none},
legend cell align=left,
xtick=data,
ytick={0,5,10,...,45},
extra x ticks={18000},
extra x tick labels={},
extra x tick style={grid=major,tick label style={rotate=90,anchor=east}},
major grid style={color=red},
every axis label={font=\footnotesize},
tick label style={font=\footnotesize},
label style={font=\footnotesize},
enlarge x limits=false,
enlarge y limits=false,
scaled x ticks=base 10:-3
]
\end{axis}
\end{tikzpicture}
\end{document}


You can use an explicit list for xmark:

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat = 1.3}
\begin{document}
\begin{tikzpicture}[scale=1.2]
\begin{axis}[
xmax=18500,
ymax=46,
legend style={legend pos = north west, font=\footnotesize, draw=none},
legend cell align=left,
xtick={0,2000,4000,6000,8000,...,14000,16000,18000},
ytick={0,5,10,...,45},
major grid style={color=red},
every axis label={font=\footnotesize},
tick label style={font=\footnotesize},
label style={font=\footnotesize},
enlarge x limits=false,
enlarge y limits=false,
scaled x ticks=base 10:-3
]