Using gnuplot within LaTeX
In a previous recipe, we learned how to generate TikZ drawing commands from within gnuplot for inclusion in a LaTeX file. This recipe is, in a way, the reverse. We are going to learn how to generate gnuplot commands from within a LaTeX document.
The method introduced in this recipe is most useful when we want to enfold graphical elements into our typeset text rather than include them in floating figure environments. It also has the advantage of encompassing all the typesetting and drawing commands into a single file that is processed with one command, with no need to keep track of plot files and separate gnuplot scripts. This makes it simpler for your document source to become self-documenting and easily modifiable.
This is a flexible and powerful technique that allows us to combine plots generated by gnuplot with TikZ drawing commands. If we become proficient in TikZ, we will be able to arrange gnuplot graphs and PGF
graphics in arbitrary ways on the page. As we...