This code
\documentclass{minimal}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
...
\path (0, 0) edge node [sloped, anchor=center, below] {line}(3, 3);
\end{tikzpicture}
\end{document}
gives the output
The text has the orientation and placement exactly as needed relative to the line which has been drawn by some other method:
\pgfpathmoveto{\pgfpointxy{0}{0}};
\pgfpathlineto{\pgfpointxy{3}{3}};
\pgfusepath{stroke}
Hence, I need only the text and not the line. How can I achieve this?
\path (0,0) -- (3,3) node [pos=0.5,sloped, anchor=center, below] {line};