Horizontal space between xticks in pgfplots

I want to create a bar graph for my master thesis. I have huge numbers on the x-axis. The problem is, that the space between the xticks corresponds to the numbers, what is of course correct. But it creates also huge spaces between the xticks, like you can see in the picture

So is it possible to make the space between the xticks equal to get a better looking graph?

Here is my code:

\begin{tikzpicture}[scale=1]
\begin{axis}[
ybar=1pt,
bar width=5pt,
xtick=data,
x tick label style={
/pgf/number format/1000 sep=
},
enlarge x limits=0.15,
ylabel={Daten[Bytes]},
xlabel={Page[Bytes]},
legend style ={at={(0.5,-0.15)}, anchor=north, legend columns=-1},
xmin=0,
%   scale mode=scale uniformly,
width=10cm,
scale only axis,
xmode=normal,
%   /pgfplots/max space between ticks=10
%nodes near coords,
%nodes near coords align={vertical}
]
\legend{Orignal, Komprimiert}
\end{axis}


Here is the table:

3408 4080
6548 8176
4792 16368
9084 32752
16608 65520

• Can you include your table into your MWE? – Zarko Oct 30 '15 at 14:47
• Apparently you have two accounts. Please contact the SE staff to get the accounts merged – user31729 Oct 30 '15 at 15:15
• Can you provide some data so that we need not spend time in cooking up one. – user11232 Oct 30 '15 at 15:24
• @HarishKumar I put the table into a file and loaded it with \pgfplotstableread{ns_halfrangealternating_compression_50000.dat}{\nsdata} – Paul Oct 30 '15 at 15:37

Here is the idea. We plot using x expr=\coordindex first. Then use xtick={0,1,2,3,4} which are the coorindate indices used in previous line. Now, we use the data from first column for the xtick labels using xticklabels from table={\nsdata}{[index]0},.

Here is the code:

\documentclass{article}
\usepackage{pgfplotstable}
3408 4080
6548 8176
4792 16368
9084 32752
16608 65520
}\nsdata
\begin{document}
\begin{tikzpicture}
\begin{axis}[
ybar=1pt,
bar width=5pt,
xtick={0,1,2,3,4},
xticklabels from table={\nsdata}{[index]0},
x tick label style={
/pgf/number format/1000 sep=
},
enlarge x limits=0.15,
%scaled ticks=false,
ylabel={Daten[Bytes]},
xlabel={Page[Bytes]},
legend style ={at={(0.5,-0.15)}, anchor=north, legend columns=-1},
xmin=0,
%   scale mode=scale uniformly,
width=10cm,
scale only axis,
xmode=normal,
%   /pgfplots/max space between ticks=10
%nodes near coords,
%nodes near coords align={vertical}
]

• @HarisgKumar, nice solution! I wonder if it is possible to define thousands separator for tick labels on x-axis, i.e. that instead 3408 will appear 3 408 etc? I try with x tick label style = {/pgf/number format/.cd, set thousands separator={\;}},, but this hasn't any influence on x tick labels formating. – Zarko Oct 30 '15 at 17:49