When I use the {axis} environment, the axis are drawn automatically so I am not able to specify a name for them? I would like to be able to compute intersections with the axis as in Intersections in PGFplots. Is there a way for me to specify a name for these axis?
One solution would be for me to redraw the axis with draw=none and then specify a name for that path, but am wondering if there is a better way. Something like xaxis name path= would be ideal?
There is a every axis key, but so perhaps I could append it to that, but then how would I specify a different name for the x-axis and y-axis?
Update The intent of my question was to find intersections with the lines x=0 and y=0 (not the boxed borders that get drawn automatically). Here is a MWE attempt:
\documentclass{standalone}
\usepackage{pgfplots}
\usetikzlibrary{intersections}
\pgfkeys{/pgfplots/Linear Axis Style/.style={
clip=true,
minor tick num=0,
axis y line=center,
axis x line=middle,
axis on top=true,
x axis line style={name path=XAxisLine},
y axis line style={name path=YAxisLine}
}
}
\begin{document}
\newcommand*{\ShowIntersection}[2]{
\fill
[name intersections={of=#1 and #2, name=i, total=\t}]
[red, opacity=1, every node/.style={black, opacity=1}]
\foreach \s in {1,...,\t}{(i-\s) circle (2pt)
node [above right] {\s}};
}
\begin{tikzpicture}
\begin{axis}[Linear Axis Style,
xmin=-1.5, xmax=1.5,
ymin=-1, ymax=3,
]
\addplot[name path global=a, mark=none, domain=-2.5:2.5, thick]%
({x},{x*x-0.5});%
%\ShowIntersection{a}{XAxisLine}% Do not work
%\ShowIntersection{a}{YAxisLine}
\end{axis}
\end{tikzpicture}
\end{document}


