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}


x=0andy=0, not the borders. Have provided a MWE adapted from your example. – Peter Grill Jun 29 '11 at 20:04axis on top, which means that the axis will be drawn at the very end, after you've called\ShowIntersections. If you move\ShowIntersectionsoutside theaxisenvironment and usename path globalinstead ofname path, it finds the intersections but for some weird reason draws the points with an offset. If you removeaxis on top, everything works, but for some reasonaxis y line=middleleads to intersections with the y axis being found twice. I'll have to look into why that is. – Jake Jun 29 '11 at 23:51xmin,xmax, etc. Have posted a follow up question on how to access xmin xmax, ymin, ymax from within PGFplots axis environment. – Peter Grill Jun 30 '11 at 23:12