I have a Tikz plot which looks (roughly) as follows:


        title={My plot},
        xlabel=X label,
        ylabel=Y label,
        ticklabel style={font=\tiny},
        xticklabels={$x_1$ (test 1),$x_2$ (test 1),$x_3$ (test 1),$x_4$ (test 1)},
        xticklabel style={text width=0.9cm},
        \addplot coordinates {((1,1)(2,1)(3,3)(4,3)(5,3)(6,3)(7,3)(8,3)(9,3)(10,3)(11,5)(12,3)(13,3)(14,3)(15,3)(16,3)(17,3)(18,3)(19,3)(20,3)(21,3)(22,3)(23,3)(24,3)(25,3)(26,3)(27,3)(28,3)(29,3)(30,3)(31,3)(32,3)(33,2)(34,2)};
        \legend{$My legend$};


resulting in the following plot: enter image description here

My question is now how I would go about creating a plot with proper xticks label spacing such that my xticks labels don't overlap.

Thank you very much for your help.


assuming that you do not want to change the x spacing, I would suggest using the rotate keyword to write the xlabels vertically:

xticklabel style={rotate=70, anchor=east},

which results in

enter image description here

  • Thank you. That does the trick. :-) – Hagbard Nov 14 '18 at 12:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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