Assuming the tick length are the same for both the major x ticks and the major y ticks, you can use
\pgfkeysgetvalue{/pgfplots/major tick length}{\labelshift}
\node[
anchor=north east,
%draw,green% to show the border of the node
]
at({xticklabel* cs:0,.5*\labelshift}-|{yticklabel* cs:0,.5*\labelshift})
{\pgfmathprintnumber{0}};
or
\node[
anchor=north east,
outer sep=.5*\pgflinewidth+.5*\pgfkeysvalueof{/pgfplots/major tick length},
%draw,green% to show the border of the node
]
at({xticklabel* cs:0}-|{yticklabel* cs:0})
{\pgfmathprintnumber{0}};
Code:
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}
\begin{document}
\begin{tikzpicture}
\begin{axis}
[
domain=-3:4,
no markers,
axis lines=middle,
xtick distance=1,ytick distance=1,
x=1cm,
y=1cm,
ymin=-2,
extra x ticks=0,
extra x tick labels=$0_x$,
extra y ticks=0,
extra y tick labels=$0_y$,
ticklabel style={draw=gray}% to show the border of the nodes
]
\addplot {x};
\addplot {-x};
\pgfkeysgetvalue{/pgfplots/major tick length}{\labelshift}
\node[
anchor=north east,
draw,green% to show the border of the node
]
at({xticklabel* cs:0,.5*\labelshift}-|{yticklabel* cs:0,.5*\labelshift})
{\pgfmathprintnumber{0}};
%% or:
%\node[
%anchor=north east,
%outer sep=.5*\pgflinewidth+.5*\pgfkeysvalueof{/pgfplots/major tick length},
%draw,green% to show the border of the node
%]
%at({xticklabel* cs:0}-|{yticklabel* cs:0})
%{\pgfmathprintnumber{0}};
\end{axis}
\end{tikzpicture}
\end{document}
If there are no other extra x ticks
you can also use
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}
\begin{document}
\begin{tikzpicture}
\begin{axis}
[
domain=-3:4,
no markers,
axis lines=middle,
xtick distance=1,ytick distance=1,
x=1cm,
y=1cm,
ymin=-2,
extra x ticks=0,
extra x tick style={
tick label style={
anchor=north east,
xshift=-.5*\pgfkeysvalueof{/pgfplots/major tick length},
green% to color this node
}},
extra y ticks=0,
extra y tick labels=$0_y$,
ticklabel style={draw=gray}% to show the border of the nodes
]
\addplot {x};
\addplot {-x};
\end{axis}
\end{tikzpicture}
\end{document}
Result:
hide obscured x ticks
ory
?