I'm try to store some coordinates of a pgfplots diagram into node in order to use them in a second time. For example I define three nodes by
\node[inner sep=0pt] (A) at (axis cs:2,2) {};
\node[inner sep=0pt] (B) at (axis cs:6,2) {};
\node[inner sep=0pt] (C) at (axis cs:3,4) {};
in order to draw a filled triangle ABC over the diagram. It works by using the "manual" way
\draw[fill=cyan](axis cs:2,2)--(axis cs:6,2)--(axis cs:3,4)--(axis cs:2,2);
But I get troubles with
\draw[color=red,fill=orange](A)--(B)--(C)--(A);
The following code generetes the image (tkz-euclide) is needed only for
\tkzDrawPoints(A,B,C)
\tkzLabelPoints(A,B,C)
Code:
\documentclass[11pt,a4paper]{article}
\usepackage{tikz,pgfplots,tkz-euclide}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
grid=both, %none
minor x tick num=0,
minor y tick num=0,
width=10cm, height=10cm,
axis x line=middle,
axis y line=middle,
samples=100,
ymin=-3.2, ymax=5.2,
xmin=-1.2, xmax=7.2,
domain=-6:6,
xlabel=$x$,
ylabel={$y$},
axis equal image % per assi in scala 1:1
]
\node[inner sep=0pt] (A) at (axis cs:2,2) {};
\node[inner sep=0pt] (B) at (axis cs:6,2) {};
\node[inner sep=0pt] (C) at (axis cs:3,4) {};
\draw[color=red,fill=orange](A)--(B)--(C)--(A);
\draw[fill=cyan](axis cs:2,-2)--(axis cs:6,-2)--(axis cs:3,0)--(axis cs:2,-2);
\end{axis}
\tkzDrawPoints(A,B,C)
\tkzLabelPoints(A,B,C)
\end{tikzpicture}
\end{document}


