Re: Plotting colorfunctions over multiple parametric curves
- To: mathgroup at smc.vnet.net
- Subject: [mg125227] Re: Plotting colorfunctions over multiple parametric curves
- From: Bob Hanlon <hanlonr357 at gmail.com>
- Date: Thu, 1 Mar 2012 05:31:39 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201202291222.HAA28337@smc.vnet.net>
n = 3; XYR = ({{-2.1, 0, 1.0}, {0, 0, 0.5}, {2.1, 0, 1.0}}); x[i_] := XYR[[i, 1]]; y[i_] := XYR[[i, 2]]; r[i_] := XYR[[i, 3]]; potential[theta_, i_] := theta + 1.0; circle[i_, theta_] := {x[i] + r[i]*Cos[theta], y[i] + r[i]*Sin[theta]}; I believe that the parameters being scaled in the ColorFunction are x, y, and theta rather than the potential function. Since you want to scale the potential function you must do this manually. Note that your potential function does not depend on i so it is the same for each circle. Show[Table[ ParametricPlot[ circle[i, theta], {theta, 0, 2 Pi}, PlotStyle -> Thick, Axes -> False, ImageSize -> 200, ColorFunction -> Function[{x, y, theta}, ColorData["TemperatureMap"][(potential[theta, i] - 1)/(2 Pi)]], ColorFunctionScaling -> False], {i, 1, n}], PlotRange -> All] Bob Hanlon On Wed, Feb 29, 2012 at 7:22 AM, Andrew Green <kiwibooga at googlemail.com> wrote: > Hi Bob > > Thanks for the reply. I am a step further thank you, but the results are strange. It is as if the colorfunction is clipping values below 0 and above 1 - it is not scaling even if ColorFunctionScaling->true is added. Consider potential[theta_,i_] = theta+1.0, I would have expected you should still get a full rainbow of colors (0 to 2pi mapped to 0 to 1), instead all are red. > > n = 3; > XYR = ( { > {-2.1, 0, 1.0}, > {0, 0, 0.5}, > {2.1, 0, 1.0} > } ); > x[i_] := XYR[[i, 1]]; > y[i_] := XYR[[i, 2]]; > r[i_] := XYR[[i, 3]]; > > potential[theta_, i_] := theta + 1.0; > circle[i_, theta_] := {x[i] + r[i]*Cos[theta], y[i] + r[i]*Sin[theta]}; > > Show[Table[ > ParametricPlot[circle[i, theta], {theta, 0, 2 Pi}, > PlotStyle -> Thick, Axes -> False, ImageSize -> 200, > ColorFunction -> > Function[{x, y, theta}, > ColorData["TemperatureMap"][potential[theta, i]]], > ColorFunctionScaling -> True], {i, 1, n}], PlotRange -> All] > > Any ideas why? > > Thanks - Andrew >