1 | initial version |
I'll post just so people don't have to jump to Tex Stack Exchange. Here's a method that will give you some freedom on your text label:
\documentclass{article}
\usepackage{sagetex}
\begin{document}
\pagestyle{empty}
\begin{sagesilent}
G=Graphics()
H=Graphics()
var('x')
G+=plot(cos(x),(x,0,pi))
H+= text("$\cos(x)$", (3, 1), fontsize=16, color='black')
\end{sagesilent}
\[ \sageplot{G+H}\]
\end{document}
See the Stack Exchange post for a more complete answer. And yes, the code above could be cleaned up (simplified) as well.