# pgfplots different ticklength for each axis

Is there an easy way to have different tick length for the X and Y axis? While a lot of the tick formating commands have x and y versions to effect only the corresponding axis, I can't find an axis specific version of major tick length. In particular xaxis tickstyle={major tick length=2pt} yields unknown key /tikz/major ticklength.

So far the only solution I can think of is two scale only axis, one for the X ticks and one for the y ticks, however copying all axis formating (i.e. min/max) up to date between axis is cumbersome. If this is the only option is ther an easy way to inherit all options from another axis?

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
tick align=outside,
xtick={1,6},
xticklabels={a,b},
ytick={0.5,0.6,0.7,0.8,0.9,1.0},
major tick length=1ex%,
%      x major tick length=0ex
]
(1,0.5)
(6,1)
};
\end{axis}
\end{tikzpicture}
\end{document}


You could just declare the x ticks to be extra, and then modify the style of these extra ticks.

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
tick align=outside,
xtick=\empty,
extra x ticks={1,6},
extra x tick style={major tick length=2pt,blue},
ytick={0.5,0.6,0.7,0.8,0.9,1.0},
major tick length=1ex%,
]

• @ted I was also wondering why xtick style={major tick length=2pt} won't work. I guess you'd need to ask this question Christian Feuersänger. And the second part I do not understand: if ytick is the empty list, then there is only one style to modify. But you can always use percusse's nice trick to get the list of "extra" ticks from the data. – user121799 Aug 9 '18 at 18:35
• @ted, @marmot: the error message complains about an unknown key /tikz/major tick length, here the /tikz/ is the important hint. Using the full path for the key (xtick style={/pgfplots/major tick length=2pt}) works. – Mike Aug 9 '18 at 22:43
• @Mike Thanks! (Still strange that for extra x tick style one doesn't need that...) – user121799 Aug 9 '18 at 22:58