4
$\begingroup$

I want to plot the overlapping regions of several inequalities. For example,

RegionPlot[{x + y > 0, x - y > 0, x^2 + y^2 < 1, x y < 1}, {x, -2, 2}, {y, -2, 2}]

The regions for the inequalities can overlap twice, three times, and so on. I want to make a plot in grayscale, such that the more times they overlap, the darker the region is. Is there a way to do that?

$\endgroup$
2

2 Answers 2

9
$\begingroup$

One way:

Show[RegionPlot[#, {x, -2, 2}, {y, -2, 2}, 
     PlotStyle -> Opacity[.3]] & /@ {x + y > 0, x - y > 0,  x^2 + y^2 < 1, x y < 1}]

Mathematica graphics

$\endgroup$
8
$\begingroup$

Or with one plot:

RegionPlot[{x + y > 0, x - y > 0, x^2 + y^2 < 1, x y < 1}, {x, -2, 2}, {y, -2, 2}, 
 PlotStyle -> ConstantArray[Directive[[email protected], Black], 4], 
 BoundaryStyle -> Thick]

enter image description here

$\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.