I would like to remove unnecessary margins (gray part in the figure below) in a PDF figure generated by epslatex (gnuplot).

Following are scripts and commands to create the figure.
set term epslatex standalone
set output "figure.tex"
set xlabel "\\LARGE $x$"
set ylabel "\\LARGE $y$"
set format x "\\Large{%.1f}"
set format y "\\Large{%.1f}"
set key left top Left
set size square
set xrange [0.0:1.0]
set yrange [0.0:1.0]
plot x with lines dt 1 lw 5.0 lc rgb "red" title "\\Large $y = x$",\
x*x with lines dt 2 lw 5.0 lc rgb "green" title "\\Large $y = x^2$",\
x*x*x with lines dt 3 lw 5.0 lc rgb "blue" title "\\Large $y = x^3$"
and commands
$ gnuplot sample.gp
$ pdflatex figure.tex
Instead of pdflatex, xelatex would also work. I would like to directly convert to PDF file.
It will be super good if we can remove these margins without too much effort (such as removing the margin manually one-by-one).
Thanks!

figure.tex? - samcarter_is_at_topanswers.xyztightboundingboxin the lua tikz driver. Alternatively, why not usepdfcropto fix the bounding box issue? - Alain Merigotstandalonemode - eng27pdfcropworked, but the command cropped also some part of the figure.... it might work out if I specify the parameter manually. - eng27