# Plotting with RegionFunction without explicit function variables

Before updating Mathematica license to version 12, I was able to exclude regions of plots (in Plot, Plot3D, DensityPlot) with RegionFunction without needing the condition to explicitly display its dependence to the variables. Now I get the following error message: "Function [...] must be a Boolean function".

As an example, I plot the following exponential function:
Plot[Exp[x], {x, 0, 1}, PlotRange -> {{0, 1}, {0, 3}}] I want to exclude points according to a function of x that is different from Exp[x], for example x^2: I used to write it:

functest = x^2;
Plot[Exp[x], {x, 0, 1}, PlotRange -> {{0, 1}, {0, 3}}, RegionFunction -> Function[{x, y}, functest < 0.5]]


But if I do so now, I get the error message and it does not exclude any points.

It works if I define the function functest with its argument:

functest[x_] := x^2;
Plot[Exp[x], {x, 0, 1}, PlotRange -> {{0, 1}, {0, 3}}, RegionFunction -> Function[{x, y}, functest[x] < 0.5]]


My problem is that functest in my code is typically a long analytical expression (for example the solutions of a system of differential equations) and I would like to find a way to call it without having to define it explicitly with respect to its variables.

• Looks like an evaluation leak that was fixed. Use Function[{x, y}, Evaluate[functest < .5]] instead. – Carl Woll Jun 3 at 19:24
• Awesome it works! – Elsa Jun 3 at 20:52