       Re: how fill PolarPlot?

• To: mathgroup at smc.vnet.net
• Subject: [mg84450] Re: how fill PolarPlot?
• From: m.r at inbox.ru
• Date: Tue, 25 Dec 2007 06:25:23 -0500 (EST)
• References: <200712230934.EAA03990@smc.vnet.net> <fknv4f\$62o\$1@smc.vnet.net>

```RegionPlot by default has PlotRange -> Full, so the x range is 1.02
and the inset with width 1.02 will be aligned exactly:

PolarPlot[Cos[2 t], {t, 0, 2 Pi}, PlotStyle -> Green,
Epilog -> Inset[RegionPlot[(x^2 + y^2)^(3/2) <= x^2 - y^2,
{x, -0.02, 1}, {y, -1, 1},
AspectRatio -> Automatic, Frame -> False, PlotRangePadding -> 0],
{0, 0}, {0, 0}, 1.02]]

Also you can simply extract the graphics primitives from RegionPlot:

PolarPlot[Cos[2 t], {t, 0, 2 Pi}, PlotStyle -> Green,
Epilog -> First@ RegionPlot[(x^2 + y^2)^(3/2) <= x^2 - y^2,
{x, -0.02, 1}, {y, -1, 1}]]

Maxim Rytin
m.r at inbox.ru

On Dec 24, 3:45=A0am, Murray Eisenberg <mur... at math.umass.edu> wrote:
> I was finally able to do this with Epilog->{Inset[RegionPlot[...]]}.
>
> Below is the entire code for the embellished plot I wanted. =A0I am still
> unhappy with at the amount of work I had to do in order to adjust the
> ImageSize of the filled leaf and the thickness of its boundary so as to
> cover up the underlying blue boundary of that leaf from the PolarPlot.
>
> Some of that adjustment could probably be avoided by using a
> ColorFunction for the overall POlarPlot. =A0But how does one set up
> ColorFunction for PolarPlot so as to specify using, say, one color for
> part of the plot and another for another part, depending on the value of
> theta alone?
>
> I found no example of ColorFunction in the documentation. =A0I tried, e.g.=
,
>
> =A0 PolarPlot[Cos[2 theta], {theta, 0, 2 Pi},
> =A0 =A0 ColorFunction ->
> =A0 =A0 =A0 Function[{theta,r}, If[-Pi/4 <= theta <= Pi/4, Red, Black]=
]]
>
> but that doesn't work as expected.
>
> The finished figure's code:
>
> =A0 =A0txt[t_,{x_,y_}]:=Style[Text[t,{x,y}],FontSize->30,FontWeight->Bol=
d]
> =A0 =A0{xmin,xmax}={-1.425,1.425}; {ymin,ymax}={-1.25,1.25};
>
> =A0 =A0PolarPlot[Cos[2t],{t,0,2Pi}, PlotRange->{{xmin,xmax},{ymin,ymax}},
> =A0 =A0 =A0PlotStyle->{ColorData["Legacy","SteelBlue"], Thickness[0.007]},=

> =A0 =A0 =A0Ticks->None,
>
> =A0 =A0 =A0Epilog->{
> =A0 =A0 =A0 =A0Inset[RegionPlot[(x^2+y^2)^(3/2)<=x^2-y^2,{x,-0.02,1},{y,=
-1,1},
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0PlotStyle->ColorData["HTML","Gold"],
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0BoundaryStyle->Directive[Thickness[0.025],
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ColorData["Legacy","CadmiumOrange"]],
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Frame->False,AspectRatio->Automatic,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ImageSize->2.6*72],
> =A0 =A0 =A0 =A0 =A0 {0.5,0}],
> =A0 =A0 =A0 =A0 Black,Thick,Dashing[{0.045,0.03}],
> =A0 =A0 =A0 =A0 Line[{{0,0},{0.85,0.85}}],Line[{{0,0},{0.85,-0.85}}],
> =A0 =A0 =A0 =A0 Dashing[{}],Thick,
> =A0 =A0 =A0 =A0 Arrow[{{xmin,0},{xmax,0}}],Arrow[{{0,ymin},{0,ymax}}],
> =A0 =A0 =A0 =A0 txt[TraditionalForm[HoldForm[r==cos 2t ]],{-0.6,1.0}],=

> =A0 =A0 =A0 =A0 txt[TraditionalForm[HoldForm[t==Pi/4]],{1.125,0.925}],=

> =A0 =A0 =A0 =A0 txt[TraditionalForm[HoldForm[t==-Pi/4]],{1.125,-0.99}]=

> =A0 =A0 =A0},
> =A0 =A0ImageSize->7*72]
>
>
>
> Murray Eisenberg wrote:
> > I Mathematica 6 I have a PolarPlot, e.g., a 4-leaved rose:
>
> > =A0 =A0PolarPlot[Cos[2 theta], {theta, 0, 2 Pi}]
>
> > How can I fill the inside -- or, what I really want, just the leaf in
> > the right half-plane -- with some color?
>
> > I note that Filling does not seem to be an option for PolarPlot (or for
> > what would be almost as good, ParametricPlot).
>
> > I tried including the following (obtained by converting from :
>
> > =A0 =A0Prolog->RegionPlot[(x^2 + y^2)^(3/2) <= x^2-y^2, {x,-0.02,1},{y=
,-1,1},
> > =A0 =A0 =A0 =A0Frame->False, AspectRatio->Automatic]
>
> > However, that led to a mysterious error message:
>
> > =A0 =A0\$Aborted is not a Graphics primitive or directive.
>
> > (Perhaps because of an incompatibility of a Prolog with cartesian
> > coordinates inside a polar coordinate plot??)
>
> --
> Murray Eisenberg =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 mur... at math.umass=
.edu
> Mathematics & Statistics Dept.
> Lederle Graduate Research Tower =A0 =A0 =A0phone 413 549-1020 (H)
> University of Massachusetts =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0413 545-2859 (W=
)
> 710 North Pleasant Street =A0 =A0 =A0 =A0 =A0 =A0fax =A0 413 545-1801
> Amherst, MA 01003-9305

```

• Prev by Date: Re: Re: how fill PolarPlot?
• Next by Date: ReplaceAll problem
• Previous by thread: Re: how fill PolarPlot?
• Next by thread: Re: how fill PolarPlot?