Often you generate a graph using Gnuplot or something, and export it as an eps. This eps is then included in your LaTeX document and processed using psfrag and pdflatex (see my other post). A fine method, however, journals generally like you to include the final figure as a pdf graphic. I have written a script that does exactly this, it takes your PSfrag commands, and the eps figure, and turns it into a pdf figure.
This blog post is a guide to the script, and explains both how to use it and how it works.
There are a few stages to the process, first the script constructs a LaTeX file. Then the script processes this LaTeX file, with all the replacements applied. Then it extracts the pdf figure as the output. Finally it cleans up all the temporary files created.