# PGF Plots remove padding around axis

I created a nice pattern using pgfplots that I want to effectively use as the background to my generated PDF. The issue is that the plot ends up with a lot of white space around it. I think I have tried all the options suggested by searching, but none have achieved what I want.

Here is what I have so far:

\documentclass[border=1cm]{standalone}
\usepackage{tikz}
\usepackage{pgfplots}

color(0mm)=(pgftransparent!0); color(0.5mm)=(pgftransparent!0);%
color(5mm)=(pgftransparent!100); color(10mm)=(pgftransparent!100)%
}
}

\pgfdeclareplotmark{fuzz}{%
}

\begin{document}
\fbox{
\begin{tikzpicture}[x=1cm,y=1cm]
\begin{axis}[
xmin=-1, xmax=1,
ymin=-1, ymax=1,
hide axis=true,
axis lines=none,
enlargelimits=false,
scale only axis,
clip bounding box=upper bound,
clip=true,
axis background/.style={inner sep=0, outer sep=0, fill=blue},
every axis label/.style={inner sep=0, outer sep=0, fill=blue},
draw opacity=0,
]
\addplot[white, only marks, mark=fuzz, samples=100, mark size=35.0] ({rand}, {rand});
\addplot[white, only marks, mark=fuzz, samples=100, mark size=25.0] ({rand}, {rand});
\addplot[white, only marks, mark=fuzz, samples=100, mark size=15.0] ({rand}, {rand});
\addplot[white, only marks, mark=fuzz, samples=100, mark size=5.0] ({rand}, {rand});
\end{axis}
\end{tikzpicture}}
\end{document}


The issue is that as you can see from the fbox, the 'image' extends beyond the limits of the 'plot'.

I need the results of the plot on the axis to be flush with the surrounding tikzpicture's box. i.e. in the generated document the blue should go all the way to the black border.

What it looks like now:

That's a really cool picture/plot! If you are willing to set the width and the height of the axis, it is straightforward to clip the white space away. (I also set the inner sep of the fbox to zero with \setlength{\fboxsep}{0pt} to show that it works.)

\documentclass[border=1cm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{width=8cm,height=8cm,compat=1.16}
color(0mm)=(pgftransparent!0); color(0.5mm)=(pgftransparent!0);%
color(5mm)=(pgftransparent!100); color(10mm)=(pgftransparent!100)%
}
}

\pgfdeclareplotmark{fuzz}{%
}
\typeout{\pgfkeysvalueof{/pgfplots/width},\pgfkeysvalueof{/pgfplots/height}}
\begin{document}
\setlength{\fboxsep}{0pt}
\fbox{\begin{tikzpicture}[x=1cm,y=1cm]
\clip[use as bounding box] (0,0) rectangle (\pgfkeysvalueof{/pgfplots/width},\pgfkeysvalueof{/pgfplots/height});
\begin{axis}[
xmin=-1, xmax=1,
ymin=-1, ymax=1,
hide axis=true,
axis lines=none,hide axis,
enlargelimits=false,
scale only axis,
clip bounding box=upper bound,
clip=true,
axis background/.style={inner sep=0, outer sep=0, fill=blue},
every axis label/.style={inner sep=0, outer sep=0, fill=blue},
draw opacity=0,
]
\addplot[white, only marks, mark=fuzz, samples=100, mark size=35.0] ({rand}, {rand});
\addplot[white, only marks, mark=fuzz, samples=100, mark size=25.0] ({rand}, {rand});
\addplot[white, only marks, mark=fuzz, samples=100, mark size=15.0] ({rand}, {rand});
\addplot[white, only marks, mark=fuzz, samples=100, mark size=5.0] ({rand}, {rand});
\end{axis}
\end{tikzpicture}}
\end{document}