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 have some repeated numbers on my X-Axis. Here is my code-

\begin{tikzpicture}
    \pgfplotstableread{Figures/measurements.dat}
    \datatable
    \begin{axis}[symbolic x coords={1.2.1.a,1.2.3.b,1.1.3.c,1.1.1.d,1.3.1.e,1.3.3.f,3.3.3.g,1.3.3.h,1.1.3.i,1.1.1.j,1.2.1.k,1.3.1.l},
    x tick label style={rotate=90,anchor=east},
    grid=major,
    xlabel=Processor Configuration,
    ylabel=Clock Cycles,
    legend pos=outer north east,
    legend columns=1,
    cycle list name=exotic,
    %xtick=data,
    xticklabels={1.2.1,1.2.3,1.1.3,1.1.1,1.3.1,1.3.3,3.3.3,1.3.3,1.1.3,1.1.1,1.2.1,1.3.1},
    x label style={at={(0.5,-0.1)}},
    ]   
    \addplot table[y=App_Stop] from \datatable ;
    \addlegendentry{App Stop};
\end{axis}
\end{tikzpicture}

And here is my data file -

Proc_config App_Stop
1.2.1.a     138 
1.2.3.b     923
1.1.3.c     1708
1.1.1.d     923
1.3.1.e     138
1.3.3.f     923
3.3.3.g     923
1.3.3.h     1427
1.1.3.i     923
1.1.1.j     923
1.2.1.k     138
1.3.1.l     923

Now you can see I have 2 entries for example for 1.2.1 renamed as 1.2.1.a and 1.2.1.k. So in order to avoid these a,b,c...,l in the x-axis tick labels I have added the command xticklabels= in the code. However, it does not display every label I have added. However, if I comment this line and uncomment the xtick=data line, I get the correct output, however it has all the suffixes a,b,c...l for every entry. How can I overcome this situation?

share|improve this question
1  
Instead of setting the position for the x label manually, you can just use \pgfplotsset{compat=1.5.1} (or newer, seeing that version 1.6 has just come out). That will set the label position to automatically take the length of the tick labels into account., –  Jake Aug 27 '12 at 13:05
    
cool :) thanks for pointing it out. –  Raj Aug 27 '12 at 13:11

1 Answer 1

up vote 3 down vote accepted

This gives the desired output:

\documentclass{article}
\usepackage{pgfplots}
\begin{document}

\begin{tikzpicture}
    \pgfplotstableread{data.dat}
    \datatable
    \begin{axis}[symbolic x coords={1.2.1.a,1.2.3.b,1.1.3.c,1.1.1.d,1.3.1.e,1.3.3.f,3.3.3.g,1.3.3.h,1.1.3.i,1.1.1.j,1.2.1.k,1.3.1.l},
    x tick label style={rotate=90,anchor=east},
    grid=major,
    xlabel=Processor Configuration,
    ylabel=Clock Cycles,
    legend pos=outer north east,
    legend columns=1,
    cycle list name=exotic,
    xtick=data,
    xticklabels={1.2.1,1.2.3,1.1.3,1.1.1,1.3.1,1.3.3,3.3.3,1.3.3,1.1.3,1.1.1,1.2.1,1.3.1},
    x label style={at={(0.5,-0.1)}},
    ]   
    \addplot table[y=App_Stop] from \datatable ;
    \addlegendentry{App Stop};
\end{axis}
\end{tikzpicture}

\end{document}

enter image description here

share|improve this answer
    
You just uncommented xtick=data, right? –  Jake Aug 27 '12 at 13:05
    
@Jake yes; that's all I did. –  Gonzalo Medina Aug 27 '12 at 13:06
    
oops... really simple. :) Thank You ! –  Raj Aug 27 '12 at 13:08

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.