Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Re: how fill PolarPlot?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg84465] Re: [mg84455] Re: [mg84431] Re: [mg84420] how fill PolarPlot?
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Wed, 26 Dec 2007 05:09:07 -0500 (EST)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <20071224091350.HNWYO.62626.root@eastrmwml30> <200712251128.GAA18408@smc.vnet.net> <BF07250C-54A5-4FB6-BB56-9606455077BD@wolfram.com>
  • Reply-to: murray at math.umass.edu

My fault: I didn't find what I was looking for about ColorFunction with 
PolarPlot on the ColorFunction reference page, and I failed to seek it 
on the PolarPlot page.

But this would probably not have happened had PolarPlot also been 
mentioned on that ColorFunction page.  (Or did I overlook it there?)

Brett Champion wrote:
> On Dec 25, 2007, at 5:28 AM , Murray Eisenberg wrote:
> 
>> Your response suggests that perhaps it's not possible directly to use
>> polar coordinates themselves as arguments to the ColorFunction function.
>>
>> If so, that's a shame.
>>
> 
>  From the PolarPlot documentation:
> 
> "The arguments supplied to functions in  MeshFunctions and  
> RegionFunction are  x, y, \[Theta], r. Functions in  ColorFunction are 
> by default supplied with scaled versions of these arguments. "
> 
> 
> You can find examples under PolarPlot > Examples > Options > ColorFunction.
> 
> Brett Champion
> Wolfram Research
> 
> 
> 
>> Bob Hanlon wrote:
>>> PolarPlot[Cos[2 theta], {theta, 0, 2 Pi},
>>>  ColorFunction ->
>>>   Function[{x, y}, If[-Pi/4 <= ArcTan[x, y] <= Pi/4, Red, Blue]],
>>>  ColorFunctionScaling -> False]
>>>
>>>
>>> Bob Hanlon
>>>
>>> ---- Murray Eisenberg <murray 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.  I 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.  But 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.  I tried, 
>>>> e.g.,
>>>>
>>>>   PolarPlot[Cos[2 theta], {theta, 0, 2 Pi},
>>>>     ColorFunction ->
>>>>       Function[{theta,r}, If[-Pi/4 <= theta <= Pi/4, Red, Black]]]
>>>>
>>>> but that doesn't work as expected.
>>>>
>>>> The finished figure's code:
>>>>
>>>>    txt[t_,{x_,y_}]:=Style[Text[t,{x,y}],FontSize->30,FontWeight->Bold]
>>>>    {xmin,xmax}={-1.425,1.425}; {ymin,ymax}={-1.25,1.25};
>>>>
>>>>    PolarPlot[Cos[2t],{t,0,2Pi}, PlotRange->{{xmin,xmax},{ymin,ymax}},
>>>>      PlotStyle->{ColorData["Legacy","SteelBlue"], Thickness[0.007]},
>>>>      Ticks->None,
>>>>
>>>>      Epilog->{
>>>>        Inset[RegionPlot[(x^2+y^2)^(3/2)<=x^2-y^2,{x,-0.02,1},{y,-1,1},
>>>>                PlotStyle->ColorData["HTML","Gold"],
>>>>                BoundaryStyle->Directive[Thickness[0.025],
>>>>                ColorData["Legacy","CadmiumOrange"]],
>>>>                Frame->False,AspectRatio->Automatic,
>>>>                ImageSize->2.6*72],
>>>>           {0.5,0}],
>>>>         Black,Thick,Dashing[{0.045,0.03}],
>>>>         Line[{{0,0},{0.85,0.85}}],Line[{{0,0},{0.85,-0.85}}],
>>>>         Dashing[{}],Thick,
>>>>         Arrow[{{xmin,0},{xmax,0}}],Arrow[{{0,ymin},{0,ymax}}],
>>>>         txt[TraditionalForm[HoldForm[r==cos 2t ]],{-0.6,1.0}],
>>>>         txt[TraditionalForm[HoldForm[t==Pi/4]],{1.125,0.925}],
>>>>         txt[TraditionalForm[HoldForm[t==-Pi/4]],{1.125,-0.99}]
>>>>      },
>>>>    ImageSize->7*72]
>>>>
>>>> Murray Eisenberg wrote:
>>>>> I Mathematica 6 I have a PolarPlot, e.g., a 4-leaved rose:
>>>>>
>>>>>    PolarPlot[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 :
>>>>>
>>>>>    Prolog->RegionPlot[(x^2 + y^2)^(3/2) <= x^2-y^2, 
>>>>> {x,-0.02,1},{y,-1,1},
>>>>>        Frame->False, AspectRatio->Automatic]
>>>>>
>>>>> However, that led to a mysterious error message:
>>>>>
>>>>>    $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                     murray at math.umass.edu
>>>> Mathematics & Statistics Dept.
>>>> Lederle Graduate Research Tower      phone 413 549-1020 (H)
>>>> University of Massachusetts                413 545-2859 (W)
>>>> 710 North Pleasant Street            fax   413 545-1801
>>>> Amherst, MA 01003-9305
>>>>
>>>
>>
>> -- 
>> Murray Eisenberg                     murray at math.umass.edu
>> Mathematics & Statistics Dept.
>> Lederle Graduate Research Tower      phone 413 549-1020 (H)
>> University of Massachusetts                413 545-2859 (W)
>> 710 North Pleasant Street            fax   413 545-1801
>> Amherst, MA 01003-9305
> 

-- 
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305


  • Prev by Date: Creating an application
  • Next by Date: Re: Avoid slow initialization of DynamicModule
  • Previous by thread: Re: Re: how fill PolarPlot?
  • Next by thread: Re: Re: Re: Re: how fill PolarPlot?