Here is the code to do this: (embedplot.tex)

\documentclass{article}
\title{Embedding graphs plotted by SAGE in \LaTeX}
\author{Priyanka Kapoor}
\usepackage{sagetex}
\begin{document}
\maketitle
Using Sage\TeX, one can use Sage to compute things and put them into
your \LaTeX{} document. Following is the example showing this.
Here's some Sage code:
\begin{sageblock}
f(x) = exp(x) * sin(2*x)
\end{sageblock}
Here's a plot of $f$ from $-1$ to $1$:
\sageplot{plot(f, -1, 1,figsize=[3,2])}
\end{document}

Run the file using commands:

$ latex embedplot.tex
$sage embedplot.sagetex.sage
$pdflatex embedplot.tex
$evince embedplot.pdf

If you want to change the plot, just change f(x) and you will get a new plot.

### Like this:

Like Loading...

*Related*

## About Priyanka Kapoor

Simple, Hardworking & friendly.....