Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I want to plot the region of points who satisfy the following equation:

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

I have been able to plot 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.

share|improve this question
1  
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] –  Chris Degnen Aug 28 at 8:31

1 Answer 1

up vote 13 down vote accepted

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

share|improve this answer
    
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 –  Tyilo Aug 28 at 11:08
    
Modify the ticks numbers. If you make number 6 of the ticks then it looks good for that. –  Junho Lee Aug 28 at 11:17
    
I tried RegionPlot[h[Sqrt[x^2+y^2],ArcTan[x,y]],{x,-6,6},{y,-6,6},Frame->False,PlotPoin‌​ts->30,Epilog->PolarPlot[6,{\[Theta],0,$MachineEpsilon},PolarAxes->True,PolarGrid‌​Lines->Automatic,PolarTicks->{"Degrees",Range[0,6]}][[1]]] which doesn't work. What do you mean exactly? –  Tyilo Aug 28 at 11:38
    
@Tyilo Sorry, Use option PolarGridLines like posted upper adding one. –  Junho Lee Aug 28 at 12:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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