Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Re: Plotting a contour plot with cylindrical co-ordinates

  • To: mathgroup at smc.vnet.net
  • Subject: [mg50231] Re: [mg50215] Re: [mg50195] Re: Plotting a contour plot with cylindrical co-ordinates
  • From: DrBob <drbob at bigfoot.com>
  • Date: Sun, 22 Aug 2004 00:19:40 -0400 (EDT)
  • References: <200408210704.DAA24776@smc.vnet.net>
  • Reply-to: drbob at bigfoot.com
  • Sender: owner-wri-mathgroup at wolfram.com

Amazing!

Bobby

On Sat, 21 Aug 2004 03:04:15 -0400 (EDT), David Park <djmp at earthlink.net> wrote:

> With DrawGraphics these examples would be done as follows.
>
> Needs["DrawGraphics`DrawingMaster`"]
>
> oldpoints = {{0, 1}, {2, 2}, {1, 3}};
> newpoints = oldpoints // FineGrainPoints[0.2, 4];
>
> Draw2D[
>     {Point /@ newpoints,
>       PointSize[0.02],
>       Point /@ oldpoints},
>     AspectRatio -> Automatic,
>     Frame -> True];
>
> Draw2D[
>     {PointSize[0.02], Point /@ newpoints,
>         PointSize[0.04], Point /@ oldpoints,
>         Red, Dashing[{0.02}], Line[oldpoints]} /.
>       DrawingTransform[#1 Cos[#2] &, #1Sin[#2] &],
>
>     AspectRatio -> Automatic,
>     Frame -> True,
>     Background -> Linen];
>
> Draw2D[
>     {{ContourDraw[r + theta, {r, 0, 1}, {theta, 0, Pi}] //
>             FineGrainPolygons[0.05, 4]} /.
>         DrawingTransform[#1 Cos[#2] &, #1Sin[#2] &],
>       Circle[{0, 0}, 1, {0, Pi}],
>       Line[{{-1, 0}, {1, 0}}]},
>     AspectRatio -> Automatic,
>     Frame -> True,
>     Background -> Linen,
>     ImageSize -> 400];
>
> David Park
> djmp at earthlink.net
> http://home.earthlink.net/~djmp/
>
>
>
> From: Peltio [mailto:peltio at twilight.zone]
To: mathgroup at smc.vnet.net
> To: mathgroup at smc.vnet.net
>
> Jake wrote:
>
>> I have a set of data which corresponds to points on a circle. I have
>> these values as a function of r and theta. Is there a way of plotting
>> this in Mathematica? The ContourPlot function requires x and y
>> co-ordinates.
>
> I'm not sure I've understood clearly your problem.
> If you want to plot a ContourPlot in polar coordinates, I would suggest to
> use a trick I've learnt from Micheal Trott's "The Vibrating Ellipse-shaped
> Drum", in The Mathematica Journal volume 6, issue 4. He plots the contour
> plot in the rectangular coordinate system and then transforms the lines and
> polyogons produced in order to adapt it to the new coordinate system.
>
> A function 'refine' is defined in order to make curves smoother. In fact a
> straight line in the x-y system is generally curve in the r-theta system,
> and it is necessary to add several intermediate points to give a smoother
> mapping.
> This is M. Trott's function:
>
>     refine[coords_, d_] := Module[
>         {n, l},
>         Join[Join @@ (
>             If[(l = (Sqrt[#1.#1] &)[Subtract @@ #1]) < d,
>                 #1,
>                 n = Floor[l/d] + 1;
>                 (Table[#1 + (i/n)*(#2 - #1), {i, 0, n - 1}] &) @@ #1] &) /@
>           Partition[coords, 2, 1], {Last[coords]}]
>     ]
>
> The parameter d sets the maximum distance between points. The following
> picture shows the points it adds to a three point line:
>
> oldpoints = {{0, 1}, {2, 2}, {1, 3}};
> newpoints = refine[oldpoints, .2];
> Show[Graphics[
>     {Point /@ newpoints,PointSize[.02], Point /@ oldpoints}],
>      Frame -> True];
>
> So, if we define a coordinate transformation like this:
>
>     toCircle[{r_, theta_}] = {r Cos[theta], r Sin[theta]};
>
> We can see the difference between the curve connecting the two transformed
> endpoints and the one connecting all the intermediate points generated by
> refine:
>
> endpoints = toCircle /@ oldpoints;
> midpoints = toCircle /@ refine[oldpoints, .2];
> Show[Graphics[{
>         Point /@ midpoints,
>         {PointSize[.02], Point /@ endpoints},
>         {Dashing[{.01, .02}], Line[endpoints], Hue[.84], Line[midpoints]}
>         }
>       ], Frame -> True];
>
> Now all we have to do, following M. Trott's solution, is to convert our
> graphics. We can use the following rule (accepting the name of the
> conversion routine):
>
>     convert[toSystem_, d_] :=
>         f : _Line | _Polygon :> (Head[f])[toSystem /@ (refine[#, d] & @@ f)]
>
> Here's an example (that can be streamlined into a procedure):
>
> gr = ContourPlot[r + theta, {r, 0, 1}, {theta, 0, Pi}];
> Show[Graphics[gr] /. convert[toCircle, 0.1],AspectRatio -> Automatic];
>
> cheers,
> Peltio
> hoping that the OP can adapt these procedures to his needs.
>
>
>
>
>
>



-- 
DrBob at bigfoot.com
www.eclecticdreams.net


  • Prev by Date: Re: Re:Playing with numbers
  • Next by Date: Re: Re: Re: Re: FindMinimum and the minimum-radius circle
  • Previous by thread: Re: Re: Plotting a contour plot with cylindrical co-ordinates
  • Next by thread: Re: 7 equations and 7 unknowns (non-linear equations)