# Remove legend if a plot in an array of plots is empty

In an array of plots of regions (inequalities) p[..] which are eventually combined using Show, how do I suppress the legend of plots which are empty, and look like this More generally, if in a given range of $$x$$ and $$y$$ over which a region is prescribed to be plotted, if RegionPlot does not find a solution (so that there is no region to shade or fill), is there a way to get a True or False value from RegionPlot corresponding to whether the region exists or not?

You can express the region using ImplicitRegion and then plot it or check the area of the region. Example:

reg = ImplicitRegion[x^2 + y^3 < 2, {{x, -2, 2}, {y, -2, 2}}];
RegionPlot[reg] Chop@N@Area[reg]


9.91915

Checking to see if the area of the region is nonzero:

If[Chop@N@Area[reg] > 0, ...]

colors = RotateLeft[ColorData /@ {1, 2, 3}];
regs = {x^2 < (y - 2)^3 + 1, (y + 2)^2 < (x - 2)^3 + 1, x + y <= -2};

Show[With[{col = First[colors = RotateRight[colors]]},
RegionPlot[#, {x, -5, 5}, {y, -5, 5}, PlotStyle -> col,
PlotLegends -> If[Area[ImplicitRegion[#, {{x, -5, 5}, {y, -5, 5}}]] === 0, None, {#}],
PlotRange -> {{-5, 5}, {-5, 5}}]] & /@ (And[#, True] & /@ regs)] Replace And[#, True] & with And[#, x >= 2 y] & to get Replace And[#, True] & with And[#, x <= y] & to get 