# Why do Disks become polygons in RegionPlot?

I want to RegionPlot a reinforced concrete section, by drawing a polygon as a rectangular shape, and on top of that, a number of circles as Disk objects, but as soon as I have more than 3 Disks, the disks become polygon shape instead of a round smooth circle.

Can you please shed some light on this issue?

(* Input: Points that makes up the perimeter of the concrete section *)
OuterPointList={{0, 0}, {300, 0}, {300, 500}, {0, 500}};

(* Input: Location of each rebar and its diameter *)
RebarList = { {{50,50}, 16}, {{250,50}, 24}, {{250, 400}, 24},
{{50, 400}, 24}, {{150, 300}, 24} };

RegionConcSect=Polygon[OuterPointList];
CreateOneRebar[Rebar_]:=Disk[ Rebar[[1]],Rebar[[2]] ];
RegionRebar = Map[CreateOneRebar,RebarList];

RegionPlot[{RegionConcSect, RegionRebar}, PlotRange -> Automatic, AspectRatio -> Automatic]


• I think that this is due to confusion in RegionPlot, since you are providing it a nested list of regions, which is not really standard syntax. Use Flatten@{RegionConcSect, RegionRebar} as its argument instead. Here is the result I see. Jul 15, 2016 at 1:16
• @MarcoB It works like a champ ! Thank you very much ! What if I want the rebars as Black and the Rectangle as Blue in color ? Jul 15, 2016 at 1:20
• @N.T.C I'd suggest using two separate plots, then combining them with Show. See my answer below for an example. Jul 15, 2016 at 1:28

The problem is due to confusion in RegionPlot, since you are providing it a nested list of regions, which is not really standard syntax.

You could use Flatten@{RegionConcSect, RegionRebar} as its argument, or alternatively construct separate plots for each region, then combine them with Show. This also has the advantage of allowing you finer control on the formatting of the individual plots:

Show[
RegionPlot[RegionConcSect, BoundaryStyle -> None],
RegionPlot[RegionRebar, PlotStyle -> Black, BoundaryStyle -> Black],
AspectRatio -> Automatic, PlotRangePadding -> None
]


Here is another take on solving the problem which doesn't resort to Show.

OuterPointList = {{0, 0}, {300, 0}, {300, 500}, {0, 500}};
RegionConcSect = Polygon[OuterPointList];

RebarList =
{{{50, 50}, 16}, {{250, 50}, 24}, {{250, 400}, 24},
{{50, 400}, 24}, {{150, 300}, 24}};
RegionRebars = RegionUnion @@ Disk @@@ RebarList

RegionPlot[
RegionDifference[RegionConcSect, RegionRebars],
PlotStyle -> RGBColor[0.95, 0.94, 0.91], (* color of concrete? *)
Prolog -> {Black, Scale[RegionConcSect, .95, RegionCentroid[RegionConcSect]]},
BoundaryStyle -> None,
AspectRatio -> Automatic]


Since documentation for RegionPlot[] contains no examples nor synopses that describe how RegionPlot should be have on a region or a list of regions/Graphics primitives, I don't think one can say authoritatively that a list of disks is a nonstandard argument. RegionPlot[] does accept a list as a single region to be plotted, and it treats it in a reasonable way, which I will explain below.

While the internal machinations are different, effectively what is plotted is

RegionPlot[{
DiscretizeGraphics[Graphics@RegionConcSect],  (* could use DiscretizeRegion[] here *)
DiscretizeGraphics[Graphics@RegionRebar]
},
AspectRatio -> Automatic]


Of course, any disk will be discretized as a polygon, but in this case, the results are unsatisfactory.

One straightforward way to get a better plot is to use RegionUnion on the rebar:

(* internally calls DiscretizeRegion[] on RegionUnion[] *)
RegionPlot[{RegionConcSect, RegionUnion @@ RegionRebar}, AspectRatio -> Automatic]


One can use PlotStyle -> {style1, style2}, substituting whatever styles are desired for styling the rectangle and the disks.

My feeling is that a list of graphics primitives is intended to be supported. What is really missing (imo) is a way to pass discretization options, such as MaxCellMeasure, to RegionPlot. The first example above, which I will explain below, illustrates that the default behavior is understandable and that the user could adjust the behavior by setting MaxCellMeasure in the way a user sometimes has to set PlotPoints or MaxRecursion in plotting. For instance, it would be nice to be able to achieve the following through options to RegionPlot without having to discretize graphics (or regions) explicitly.

RegionPlot[{
DiscretizeGraphics[Graphics@RegionConcSect],
DiscretizeGraphics[Graphics@RegionRebar, MaxCellMeasure -> {"Length" -> 10.}]
},
AspectRatio -> Automatic]


To understand better what to expect from RegionPlot, here is an explanation of what is happening internally. RegionPlot picks a MaxCellMeasure setting based on the bounds of the region being plotted. The list RegionRebar is treated as a single object to be plotted, which has rather large bounds and gets a pretty big MaxCellMeasure setting. By contrast, RegionUnion @@ RegionRebar evaluates to RegionUnion[Disk[<>], Disk[<>],...] and symbolically represents the union of several regions instead of a single graphics. RegionPlot calls DiscretizeRegion on this, and the procedure that analyzes the union results in a finer discretization. One might criticize the default behavior for not plotting the list like RegionUnion @@ RegionRebar instead of like Graphics@RegionRebar.