Re: Text on a curve
- To: mathgroup at smc.vnet.net
- Subject: [mg104794] Re: Text on a curve
- From: dh <dh at metrohm.com>
- Date: Tue, 10 Nov 2009 05:59:24 -0500 (EST)
- References: <hd6bh0$olc$1@smc.vnet.net>
Bill wrote: > Text on a curve > > > Hi: > > Using the following Mathematica 6.0.1 code, I get a nice picture as follows: > > Module[{f, fs, t}, f[t_] = {Cos[t] + Sin[t], Sin[t]}; > fs[t_] = D[f[t], t] // N; > h = Graphics[Rotate[Style[Text[" > T"], 14], 90 Degree]]; > Show[Graphics[{Arrowheads[{{Automatic, Automatic, h}}], {Red, > Arrow /@ > MapThread[{#1 + > 0.001 #2, (#1 - > 2 #2)} &, {f /@ #, ({-1, 1} Reverse[#]/21) & /@ (#/ > Sqrt[#.#] & /@ (fs /@ #))} &[#]]}, {Thickness[0.005], {Blue, > Line[f /@ #]}}} &[ > Table[\[Rho], {\[Rho], 0.0, 2*Pi // N, 2*Pi/26 // N}]]], > AspectRatio -> Automatic, Axes -> True, > PlotRange -> {{-1.6, 1.6}, {-1.6, 1.6}}, ImageSize -> 500]] > > Question: How can the code be modified to place selected letters at different positions, forming a sentence around the curve, such as: > > ~Typing onto a curve > > > > Thanks, > > Bill > Hi Bill, you need to declare a different arrowhead for each arrow. E.g.: Module[{f, fs, t}, f[t_] = {Cos[t] + Sin[t], Sin[t]}; fs[t_] = D[f[t], t] // N; h = Graphics[ Rotate[Style[Text["\n" <> #], {0, 100}, 14], 90 Degree]] & /@ Characters["Typing onto a curve works "]; i = 0; Show[Graphics[{{Red, {Arrowheads[{{Automatic, Automatic, h[[++i]]}}], Arrow[#]} & /@ MapThread[{#1 + 0.001 #2, (#1 - 2 #2)} &, {f /@ #, ({-1, 1} Reverse[#]/21) & /@ (#/ Sqrt[#.#] & /@ (fs /@ #))} &[#]]}, {Thickness[ 0.005], {Blue, Line[f /@ #]}}} &[ Table[\[Rho], {\[Rho], 0.0, 2*Pi // N, 2*Pi/26 // N}]]], AspectRatio -> Automatic, Axes -> True, PlotRange -> {{-1.6, 1.6}, {-1.6, 1.6}}, ImageSize -> 500]] Daniel