Re: Filled Polar plots
- To: mathgroup at smc.vnet.net
- Subject: [mg85168] Re: Filled Polar plots
- From: Szabolcs Horvát <szhorvat at gmail.com>
- Date: Wed, 30 Jan 2008 06:18:10 -0500 (EST)
- Organization: University of Bergen
- References: <fnk3hf$ktg$1@smc.vnet.net>
Yaroslav Bulatov wrote: > What is the recommended way of creating filled polar plots? (assuming > it forms a closed non-intersecting curve) > > I'm looking to create something like the image on http://en.wikipedia.org/wiki/Superformula, > but PolarPlot doesn't seem to have Filling options > > formula[m_, n1_, n2_, n3_] = > Function[{x}, (Cos[(m x)/4]^n2 + Sin[(m x)/4]^n3)^(-1/n1)]; > vals = {{3, 5, 18, 18}, {2, 1, 4, 8}, {3, 3, 14, 2}, {7, 2, 8, 4}}; > Table[PolarPlot[(formula @@ v)[x], {x, -Pi, Pi}, PlotRange -> All, > Axes -> None], {v, vals}] // GraphicsColumn > Hi, Please see this thread: http://groups.google.com/group/comp.soft-sys.math.mathematica/browse_thread/thread/a0a222f63839d1bc/6a0ee2b9dc9df186 Probably the best and most efficient suggestion is the one given by Andrzej Kozlowski: change the Line to Polygon in the output: PolarPlot[Cos[6 theta] + 5, {theta, 0, 2 Pi}] /. Line -> Polygon Make it prettier: PolarPlot[Cos[6 theta] + 5, {theta, 0, 2 Pi}, Axes -> False] /. Line[arg_] :> {{Opacity[.5], Polygon[arg]}, {Thick, Line[arg]}} The first thing that I thought of was to use the two-parameter form of ParametricPlot, like the last "Basic Example" on the doc page of ParametricPlot, but the problem is that when the axes are removed, an ugly line connecting the curve with the centre becomes visible: ParametricPlot[(Cos[6 theta] + 5) {Cos[theta], Sin[theta]} r, {theta, 0, 2 Pi}, {r, 0, 1}, Mesh -> False, PlotPoints -> {30, 2}, Axes -> False] It was a nasty trick---not removing the axes in the documentation example. Szabolcs