Can't plot rotated region - Mathematica Stack Exchange most recent 30 from mathematica.stackexchange.com 2019-09-21T20:23:51Z https://mathematica.stackexchange.com/feeds/question/55298 https://creativecommons.org/licenses/by-sa/4.0/rdf https://mathematica.stackexchange.com/q/55298 7 Can't plot rotated region m_goldberg https://mathematica.stackexchange.com/users/3066 2014-07-19T11:54:32Z 2014-07-21T09:36:51Z <p>I was experimenting with the code from <a href="https://mathematica.stackexchange.com/q/55288/3066">this question</a> when I ran into another problem with regions.</p> <pre><code>Ω = RegionDifference[Rectangle[{0, 0}, {10, 10}], Rectangle[{4, 4}, {8, 8}]]; RegionPlot[Ω] </code></pre> <p><img src="https://i.stack.imgur.com/HkCCM.png" alt="plot"></p> <pre><code>Ω1 = TransformedRegion[Ω, RotationTransform[45 °, {5, 5}]]; RegionQ[Ω1] </code></pre> <blockquote> <pre><code>True </code></pre> </blockquote> <pre><code>RegionPlot[Ω1] </code></pre> <blockquote> <p>RegionPlot::invplotreg: TransformedRegion[RegionDifference[Rectangle[{0, 0}, {10, 10}], Rectangle[{4, 4}, {8, 8}]], TransformationFunction[...]] is not a valid region to plot. >></p> </blockquote> <p>What is the difference between a "valid region to plot" and a region that satisfies <code>RegionQ</code>? Or, perhaps, to put it better, am I seeing a bug in <code>RegionPlot</code> or just an incomplete implementation?</p> <p>I note that </p> <pre><code>RegionPlot[TransformedRegion[Rectangle[], RotationTransform[45 °, {.5, .5}]], PlotRange -&gt; All] </code></pre> <p>works as expected, so it would seem <code>RegionPlot</code> can handle rotations for some class of inputs.</p> https://mathematica.stackexchange.com/questions/55298/-/55442#55442 6 Answer by user21 for Can't plot rotated region user21 https://mathematica.stackexchange.com/users/18437 2014-07-21T09:36:51Z 2014-07-21T09:36:51Z <p>Here is a workaround:</p> <pre><code>r1 = RegionDifference[Rectangle[{0, 0}, {10, 10}], Rectangle[{4, 4}, {8, 8}]]; r2 = TransformedRegion[r1, RotationTransform[45 \[Degree], {5, 5}]]; mr = DiscretizeRegion[r2] </code></pre> <p><img src="https://i.stack.imgur.com/HQn8q.jpg" alt="enter image description here"></p> <p>And then:</p> <pre><code>RegionPlot[mr] </code></pre> <p><img src="https://i.stack.imgur.com/aDZQ0.jpg" alt="enter image description here"></p>