12
$\begingroup$

I'd want to plot the region of points which satisfy the following equation:

2 < r <= 5 && 3/4 π < θ <= 5/4 π

I have been able to plot the region in Cartesian coordinates:

h[r_, θ_] := 2 < r <= 5 && 3/4 π < θ < 5/4 π
RegionPlot[h[Sqrt[x^2 + y^2], ArcTan[x, y]], {x, -6, 6}, {y, -6, 6}, PlotPoints -> 100]

enter image description here

I would like to plot the region with polar axes, but I don't think I can make PolarPlot plot a region probably.

$\endgroup$
  • 1
    $\begingroup$ As mentioned in the PolarPlot docs (Properties & Relations section), PolarPlot is a special case of ParametricPlot for curves, and (though perhaps unsuitable for your application), you can plot regions with ParametricPlot, e.g. ParametricPlot[r {θ Cos[θ], θ Sin[θ]}, {θ, 0, 4 Pi}, {r, 1, 1.5}, Mesh -> False] $\endgroup$ – Chris Degnen Aug 28 '14 at 8:31
20
$\begingroup$

Update

Compare two pictures. First is able to make mistake like you made the code.

Blockquote

You need to do like this code using Mod[ArcTan[x, y], 2π].

h[r_,θ_] := 2 < r <= 5 && 3/4 π < θ < 3/2 π
RegionPlot[
 h[Sqrt[x^2 + y^2], Mod[ArcTan[x, y], 2π]], {x, -6, 6}, {y, -6, 6}]

Blockquote

So I suggest to use ParametricPlot like this.

rg = 6; mg = 3;

ParametricPlot[{r Cos[θ], r Sin[θ]}, {r, 2, 5}, {θ, 3/4 π, 5/4 π},
 Frame -> False, Axes -> False,
 PlotRange -> {-rg - mg, rg + mg},
 Epilog -> PolarPlot[rg, {θ, 0, $MachineEpsilon}, 
    PolarAxes -> True,
    PolarGridLines -> {Automatic, Range[rg]},
    PolarTicks -> {Drop[Table[i, {i, 0, 2 Pi, Pi/8}], -1], 
      Automatic}][[1]]
 ]

Blockquote


Origin

This is my trick. I used option Epilog.

RegionPlot[
 h[Sqrt[x^2 + y^2], ArcTan[x, y]], {x, -6, 6}, {y, -6, 6}, 
 Frame -> False, PlotPoints -> 30,
 Epilog -> PolarPlot[5, {\[Theta], 0, $MachineEpsilon},
    PolarAxes -> True, 
    PolarGridLines -> Automatic,
    PolarTicks -> {"Degrees", Automatic}][[1]]
 ]

Blockquote

And I tried also PolarTicks like this.

PolarTicks -> {Drop[Table[i, {i, 0, 2 Pi, Pi/4}], -1], Automatic}

enter image description here

PolarGridLines Usage

RegionPlot[
 h[Sqrt[x^2 + y^2], ArcTan[x, y]], {x, -6, 6}, {y, -6, 6}, 
 Frame -> False, PlotPoints -> 30,
 Epilog -> PolarPlot[6, {\[Theta], 0, $MachineEpsilon},
    PolarAxes -> True, 
    PolarGridLines -> {Automatic, Range[6]},
    PolarTicks -> {Drop[Table[i, {i, 0, 2 Pi, Pi/4}], -1], 
      Automatic}][[1]]
 ]

enter image description here

$\endgroup$
  • $\begingroup$ How can I get coordinates from 0 to 6 instead of 0 to 5? Changing the 5 in PolarPlot to 6 produces this graphic, where the region isn't correct: i.imgur.com/7HYupnR.png $\endgroup$ – Tyilo Aug 28 '14 at 11:08
  • $\begingroup$ Modify the ticks numbers. If you make number 6 of the ticks then it looks good for that. $\endgroup$ – Junho Lee Aug 28 '14 at 11:17
  • $\begingroup$ I tried RegionPlot[h[Sqrt[x^2+y^2],ArcTan[x,y]],{x,-6,6},{y,-6,6},Frame->False,PlotPoints->30,Epilog->PolarPlot[6,{\[Theta],0,$MachineEpsilon},PolarAxes->True,PolarGridLines->Automatic,PolarTicks->{"Degrees",Range[0,6]}][[1]]] which doesn't work. What do you mean exactly? $\endgroup$ – Tyilo Aug 28 '14 at 11:38
  • $\begingroup$ @Tyilo Sorry, Use option PolarGridLines like posted upper adding one. $\endgroup$ – Junho Lee Aug 28 '14 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.