Make sure that there's nothing extra on the page (page numbers, for example, using `\thispagestyle{empty}`) and then use the command `pdfcrop` which is included in TeXLive.  (It's a perl script).

That's what I used to make this picture for [this answer]( on MathOverflow:

<img src="" alt="Graph of n to 2n" title="Graph of n to 2n">

(source file: <>)