Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to plot some data using pgfplot. Here is what I got for now:

\begin{tikzpicture}
\begin{axis}[
  xlabel=X,
  xmin = 0,
  xtick = {1,2,3,4,8},
  ylabel=Y,
  enlargelimits=false
]

\addplot coordinates {
  (1,   2000)
  (2,   5000)
  (3,   8000)
  (4,   11000)
  (8,   13000)
};
\addlegendentry{A}
\end{axis}
\end{tikzpicture}

The display is OK, but I do not want to have more space between 4 and 8 than between 1 and 2. I want the same space between each x tick.

Is that possible ?

share|improve this question
1  
What is the meaning of your x-coordinates, if it is not the position? (you can use 1,2,3,4,5 instead of 1,2,3,4,8 !?) –  Hans-Peter E. Kristiansen Mar 13 '12 at 15:17
1  
In my case, it's a number of threads. It has an important meaning –  Baptiste Wicht Mar 13 '12 at 15:24

1 Answer 1

up vote 6 down vote accepted

You could change the xtick and xticklabels as follows

  xtick = {1,2,3,4,5},
  xticklabels = {1,2,3,4,8},

which gives

screenshot

\documentclass{article}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
  xlabel=X,
  xmin = 0,
  xtick = {1,2,3,4,5},
  xticklabels = {1,2,3,4,8},
  ylabel=Y,
  enlargelimits=false
]

\addplot coordinates {
  (1,   2000)
  (2,   5000)
  (3,   8000)
  (4,   11000)
  (5,   13000)
};
\addlegendentry{A}
\end{axis}
\end{tikzpicture}

\end{document}
share|improve this answer
    
Oh god... That's was too easy. Thanks a lot :) –  Baptiste Wicht Mar 13 '12 at 15:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.