Re: Plotting colorfunctions over multiple parametric curves
- To: mathgroup at smc.vnet.net
- Subject: [mg125199] Re: Plotting colorfunctions over multiple parametric curves
- From: Bob Hanlon <hanlonr357 at gmail.com>
- Date: Tue, 28 Feb 2012 00:46:13 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201202271140.GAA29360@smc.vnet.net>
You could either combine multiple plots rather than use mutiple curves in a single plot or use two parameters. n = 5; potential[theta_, i_] = Sin[2*i*theta]; x[i_] = i; y[i_] = 2 - i; r[i_] = 3 + i; circle[i_, theta_] = { x[i] + r[i]*Cos[theta], y[i] + r[i]*Sin[theta]}; Showing the two approaches side-by-side: Row[{ 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]]]], {i, n}], PlotRange -> All], ParametricPlot[ circle[i, theta], {theta, 0, 2 Pi}, {i, 1, n}, Axes -> False, Frame -> False, ImageSize -> 200, Mesh -> {0, Range[n]}, MeshStyle -> AbsoluteThickness[1], ColorFunction -> Function[{x, y, theta, i}, ColorData["TemperatureMap"][ potential[theta, i]]]]}] On Mon, Feb 27, 2012 at 6:40 AM, Andrew Green <kiwibooga at googlemail.com> wrote: > Hi there > > I am a bit stuck with this one. I have several curves (circles in this > case) I want to plot at the same time. Each circle also has its own > function defining a unique potential as a function of theta around the > curve. I want to take advantage of Mathematica's colorfunction color > scaling and show the potential around each curve in a color scaled to > the min and max values for the entire set of circle potentials. I get > about this far.... > > n = 5; (*number of circles*) > > potential[theta_, i_] := Sin[2*i*theta]; > > circle[i_, theta_] := {x[i] + r[i]*Cos[theta], y[i] + > r[i]*Sin[theta]}; (*x,y, and r are earlier defined vectors of > coordinates, radius*) > > ParametricPlot[ > Evaluate@Table[circle[i, theta], {i, 1, n}], {theta, 0, 2 Pi}, > PlotStyle -> Thick, Axes -> False, > ColorFunction -> > Function[{x, y, theta}, ColorData["TemperatureMap"][theta]]]; > > I can get a nice rainbow color around each circle but it is the same > for all because I can only seem to define one colorfunction and cannot > incorporate the potential function which varies for each circle "i". > > Any help would be most appreciated. > > > Andrew Green
- References:
- Plotting colorfunctions over multiple parametric curves
- From: Andrew Green <kiwibooga@googlemail.com>
- Plotting colorfunctions over multiple parametric curves