6
$\begingroup$

I would like to shade area of region as a function of angle using PolarPlot. Here is my attempt.

With[
  {pts = 
    Cases[PolarPlot[1 + 2 Sin[θ], {θ, 0, 2 π}], _Line, {0, Infinity}][[1, 1]]},
  Manipulate[
    Show[
      ListLinePlot[{{{0, 0}, pts[[n]]}, pts[[1 ;; n]]}, 
        Filling -> {2 -> {Axis, LightBlue}, 1 -> {Axis, LightBlue}}, 
        PlotRange -> {{-2, 2}, {-0.5, 3.2}}, AspectRatio -> 1, 
        PlotStyle -> Directive[AbsoluteThickness@3, Magenta, Magenta], 
        ImageSize -> 500, AxesStyle -> Directive[Black, 18], 
        PlotLabel -> Style["r=1+2 sin(θ)", Black, 20]], 
      PolarPlot[1 + 2 Sin[θ], {θ, 0, 2.2 π}, 
        AspectRatio -> 1, PlotStyle -> {Black, AbsoluteThickness@3}]], 
    {n, 1, Length @ pts, 1}]]

enter image description here

enter image description here

Two thing I would like to achieve:

  1. I don't want to see the yellow highlited region.
  2. When inner loop is shaded twice, I would like to make it darker to emphasize that it is the 2nd time.

Any suggestion..

$\endgroup$
5
$\begingroup$

This is what you need:

Manipulate[ParametricPlot[
  r (1 + 2 Sin[θ]) {Cos[θ], Sin[θ]},
  {θ, 0, thmax},
  {r, 0, 1},
  PlotRange -> {{-2.25, 2.25}, {-0.5, 3.5}},
  PerformanceGoal -> "Quality"
  ], {thmax, 0.01, 2 Pi}]

Mathematica graphics

$\endgroup$

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.