Fill 2D regions by drawing tools

Posted 10 years ago
3333 Views
|
4 Replies
|
3 Total Likes
|
 Hi,I made a complete, nice 2D drawing just by using the drawing tools in Mathematica. As I have to fill an half-disk (and more complicated regions) in the drawing with a specific color, I was wondering how to do that with the same drawing tools: the only thing that I was successful to find (as a neophyte), aside from circles, are filled-color rectangles and polygons, but no regions with piecewise regular boundaries. I really hope that someone will give me a hint .Cordially,Bruno
4 Replies
Sort By:
Posted 10 years ago
 Try this:RegionPlot[{1 < x^2 + y^2 < 4, 1 < x^2 + y^2 < 4 && -2 < x < -1,   1 < x^2 + y^2 < 4 && 0 < x < 1/2, 1 < x^2 + y^2 < 4 && -1 < x < 0,   1 < x^2 + y^2 < 4 && 1/2 < x < 2}, {x, -2, 2}, {y, -2, 2}, PlotStyle -> {None, Directive[Blue, Opacity[0.4]],    Directive[Green, Opacity[0.4]], Directive[Yellow, Opacity[0.4]],    Directive[Red, Opacity[0.4]]}, PlotPoints -> 60, MaxRecursion -> 3]
Posted 10 years ago
 Fantastic! Thank you so much!Bruno
Posted 10 years ago
 Hi Bruno,If it is not a simple polygon I think you have to do it programmatically, either by using RegionPlot, or by using FilledCurve.
Posted 10 years ago
 Thank you so much!I tried to follow your advice, I'm sending you a sample. The only problem that I have concerns filling the little white part between the blue and the yellow zone, and  the upper yellow-green-red zones. I didn't succeed yet in doing that, may you help me in fixing also this problem?Thanks you so much,BrunoRegionPlot[{1 < x^2 + y^2 < 4, 1 < x^2 + y^2 < 4 && -2 < x < -1,   1 < x^2 + y^2 < 4 && 0 < x < 1/2, 1 < x^2 + y^2 < 4 && -1 < x < 0,   1 < x^2 + y^2 < 4 && 1/2 < x < 2}, {x, -2, 2}, {y, -2, 2}, PlotStyle -> {None, Directive[Blue, Opacity[0.4]],    Directive[Green, Opacity[0.4]], Directive[Yellow, Opacity[0.4]],    Directive[Red, Opacity[0.4]]}]