4
$\begingroup$

I am trying to make a polar plot of a two variable function, which has a radial and an angular part. For instance Y[r,φ]=r^2 Cos[φ].

I can make this plot using ContourPlot, but is there a way to do it using PolarPLot? My ContourPlot is

Y[r_, f_] := r^2 Cos[f]
ContourPlot[Y[Sqrt[x^2 + y^2], ArcTan[x, y]], {x, 0, 1}(*Radius till 1*), {y, 0, 60}(*Angle from 0 to 60*)]

$\endgroup$
  • $\begingroup$ The argument of Cos, ArcTan etc. is assumed to be in radians, multiply by Degree to convert from degrees. $\endgroup$ – VLC Feb 22 '13 at 13:49
  • $\begingroup$ Well, the help on PolarPlot[] states "Use ContourPlot and RegionPlot for implicit curves and regions:" $\endgroup$ – Dr. belisarius Feb 22 '13 at 14:13
  • $\begingroup$ @VLC:Thank's for that! I didn't know it!!! $\endgroup$ – Thanos Feb 22 '13 at 14:16
  • $\begingroup$ @belisarius: I've seen, but I would like to plot this two variable function in the most efficient way...and I am not sure on how to do it without polar plot... $\endgroup$ – Thanos Feb 22 '13 at 14:58
  • $\begingroup$ Well, I just posted an answer :) $\endgroup$ – Dr. belisarius Feb 22 '13 at 14:59
2
$\begingroup$

PolarPlot[] is a handicapped plotting function (it doesn't support Filling, for example). Much easier with other functions:

h[r_, f_] := r^2 Cos[f]
Quiet@Show[
        ContourPlot[h[Sqrt[x^2 + y^2], ArcTan[x, y]], {x, 0, 1}, {y, 0, 1},
                  RegionFunction -> Function[{x, y, f}, 0 < ArcTan[x, y] < Pi/3 && x^2 + y^2 < 1],
                  Contours -> 10,  AspectRatio -> 1], 
         Graphics@Circle[]]

Mathematica graphics

Another possibility:

Plot3D[h[Sqrt[x^2 + y^2], ArcTan[x, y]],
 {x, -1, 1},
 {y, -1, 1},
 AspectRatio -> 1,
 ColorFunction -> "SunsetColors",
 MeshFunctions -> {#3 &},
 Mesh -> 7,
 PlotStyle -> Directive[Specularity[White, 50], Opacity[0.8]]]

Mathematica graphics

You may even draw your Pi/3 angle on the surface:

Plot3D[h[Sqrt[x^2 + y^2], ArcTan[x, y]],
 {x, -1, 1},
 {y, -1, 1},
 AspectRatio -> 1,
 ColorFunction -> "SunsetColors",
 MeshFunctions -> {UnitBox@(ArcTan[#2, #1] - Pi/3) &},
 Mesh -> 7,
 PlotStyle -> Directive[Specularity[White, 50], Opacity[0.8]]]

Mathematica graphics

$\endgroup$
  • $\begingroup$ I believe the first plot should be fine!!! Thank you! $\endgroup$ – Thanos Feb 22 '13 at 15:33

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.