# Access Parameters of tikzpictures axis-environment

Suppose I defined a parameter, coordinate, node or similar within the axis-environment of a tikzpicture and I would like to access those. See e.g.:

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{calc}

\begin{document}

\begin{tikzpicture}
\begin{axis}[<parameters>]
\def\V{5};
(0,0) node[color=red](node){Node};
\end{axis}
(0,\V) node[color=red](node2){Node2};
\end{tikzpicture}

\end{document}


Is there some kind of access Modifier (i.e. global/public), so I can use \V or node outside of the axis-environment?

Remark: I am aware, I could define them outside of the axis-environment, and access them within axis, but I am calculating intersections, using \path [name intersections={of=function1 and function2,by=intersection}];, see Intersection, so this is not an Option. Thank you for your help, it is appreciated.

• Welcome to TeX.SE! If you define a coordinate within an axis, you can access it inside. Likewise, if you define two paths within an axis, you can compute their intersections outside. And with \xdef\V{5} you make a definition global, if that's what you want. – user121799 Nov 8 '18 at 16:02
• Thank you :-). \xdef\V{5} helped. – Hiwi Makro Nov 8 '18 at 16:11

Welcome to TeX.SE! Quite possible that I do not understand your question. Here is a compilable version of your code in which the outside node is drawn relative to a node inside the axis.

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\usetikzlibrary{calc}

\begin{document}

\begin{tikzpicture}
\begin{axis}%[xmin=0,xmax=1]
\xdef\V{5};
\path (0,0) node[color=red] (node) {Node};
\addplot[draw=none] {x}; % needed to make pgfplots draw the node
\end{axis}
\path ([yshift=\V*1cm]node) node[color=red](node2){Node2};
\end{tikzpicture}

\end{document}


Is that what you want? If not, could you perhaps explain in a different way? (Notice that I corrected the syntax of the nodes in your example.)