Group Abstract Group Abstract

Message Boards Message Boards

Fill 2D regions by drawing tools

GROUPS:
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
POSTED BY: Bruno Volzone
Answer
11 months 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 BY: Sander Huisman
Answer
11 months 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,

Bruno
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]]}]
POSTED BY: Bruno Volzone
Answer
11 months 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 BY: Sander Huisman
Answer
11 months ago
Fantastic!
Thank you so much!

Bruno
POSTED BY: Bruno Volzone
Answer
11 months ago