4
$\begingroup$

I have two functions $f(x,y)$ and $g(x,y)$. I wish to perform two tasks on a 2-dimensional figure:

  1. Plot the curve where each point satisfies $f(x,y)=g(x,y)$.

  2. Mark one side of the curve with red.

I tried to use Plot3D like the following

myfunc[x_, y_]:= If[f[x, y] < g(x, y), 1,0];
Plot3D[myfunc[x, y], {x, 0, 10}, {y, 0, 3}]

It gives what I expected, but how can I do this in a 2D plot?

$\endgroup$

2 Answers 2

4
$\begingroup$
RegionPlot[f[x, y] <= g[x, y], {x, 0, 10}, {y, 0, 3}]
$\endgroup$
1
  • $\begingroup$ thanks! I didn't know this before. $\endgroup$
    – RandomBear
    Commented Mar 20, 2019 at 23:41
4
$\begingroup$
ContourPlot[f[x, y] - g[x, y], {x, 0, 10}, {y, 0, 3}, 
  Contours -> {{0}}, ContourShading -> {None, Red}]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.