# Fill everything except a circle in the middle of the plot

I need to make several Plots to show convergence. One of those needs to be opaque with a white circle in the middle where alpha is not allowed.

In the code you can see what i'm thinking about. The circle should be in the background though. Axis labels etc should be in the upper layer.

I have also tried to do it with fill between commands though i didn't get it to work.

MWE

\documentclass[a4paper]{scrartcl}
\usepackage{tikz,pgfplots}
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{intersections}
\usetikzlibrary{backgrounds}
\usepackage{graphicx}
\begin{document}
\begin{tikzpicture}[background rectangle/.style={fill=gray!50}, show background rectangle]
\begin{axis}[
width=1.3\linewidth,
xmin=-2,
xmax=2,
ymin=-2,
ymax=2,
axis equal,
axis lines=middle,
xlabel=Re($z$),
ylabel=Im($z$),
disabledatascaling]
\end{axis}
\end{tikzpicture}
\end{document}


you mean something like this?

above image is obtain with use of the option axis on top. in code is corrected the image width. now is not wider than the width of text.

\documentclass[a4paper]{scrartcl}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\usepgfplotslibrary{fillbetween}

\usetikzlibrary{backgrounds,
intersections}

\begin{document}
\begin{tikzpicture}[
background rectangle/.style={fill=gray!50}, show background rectangle]
\begin{axis}[
width=\linewidth,
xmin=-2,
xmax= 2,
ymin=-2,
ymax= 2,
axis equal,
axis lines=middle,
xlabel=Re($z$),
ylabel=Im($z$),
disabledatascaling,
axis on top]                % <---
\end{axis}
\end{tikzpicture}
\end{document}


Here is a solution based on even odd rule, which avoids filling first gray and then white on top, and is thus arguably closer to what's asked in the title: "Fill everything except a circle in the middle of the plot".

\documentclass[a4paper]{scrartcl}
\usepackage{tikz,pgfplots}
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{intersections}
\usetikzlibrary{backgrounds}
\usepackage{graphicx}
\begin{document}
\begin{tikzpicture}[background rectangle/.style={fill=gray!50,even odd rule,
show background rectangle]
\begin{axis}[at={(0,0)},anchor=center,
width=1.3\linewidth,
xmin=-2,
xmax=2,
ymin=-2,
ymax=2,
axis equal,
axis lines=middle,
xlabel=Re($z$),
ylabel=Im($z$),
disabledatascaling]

\end{axis}
\end{tikzpicture}
\end{document}