Message Boards Message Boards

0
|
3593 Views
|
4 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Fill 2D regions by drawing tools

Posted 11 years ago
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
4 Replies
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
Posted 11 years ago
Fantastic!
Thank you so much!

Bruno
POSTED BY: Bruno Volzone
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
Posted 11 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,

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
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract