MathGroup Archive 2004

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

Search the Archive

Combining two paramteric plots into one.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49094] Combining two paramteric plots into one.
  • From: Bob Harris <nitlion at mindspring.com>
  • Date: Thu, 1 Jul 2004 05:25:39 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Howdy,

I'm trying to plot two ellipses together on one plot.  I have accomplished
this, except that mathematica plots three figures-- ellipse 1, then ellipse
2, then the combination of the two.  I want to avoid the first two figures.

Here's what I am doing.

ellipsePoint[{xc_, yc_, w_, h_, a_}, t_] :=
    {((w Cos[a] Cos[t] - h Sin[a] Sin[t]) + xc)/2,
     ((w Sin[a] Cos[t] + h Cos[a] Sin[t]) + yc)/2}

ellipsePlot[{xc_, yc_, w_, h_, a_}] :=
    ellipsePlot[{xc, yc, w, h, a}, 20]

ellipsePlot[{xc_, yc_, w_, h_, a_}, n_] :=
    ParametricPlot[
      {ellipsePoint[{xc, yc, w, h, a}, 2\[Pi] t/n][[1]],
       ellipsePoint[{xc, yc, w, h, a}, 2\[Pi] t/n][[2]]},
      {t, 0, n},
      AspectRatio -> Automatic]

ellipsePlotTwo[{xc1_, yc1_, w1_, h1_, a1_},
               {xc2_, yc2_, w2_, h2_, a2_}] :=
    Show[
      ellipsePlot[{xc1, yc1, w1, h1, a1}],
      ellipsePlot[{xc2, yc2, w2, h2, a2}]]

Apparently what happens is ParametricPlot[...] always draws a figure so when
I call it inside Show (via ellipsePlot[...]), I get a figure drawn that I
don't want to draw yet.  How can I call ParametricPlot and just get the
resulting graphical object without it drawing it?

I have similar problems with other combinations with ellipsePlot.  For
example, using ListPlot to try to add a list of points on the figure (i.e.
Show[ellipsePlot[...], ListPlot[...]]) I get three figures instead of just
the one I want.

Thanks,
Bob H


  • Prev by Date: Re: function IF with several equality conditions
  • Next by Date: Re: Accuracy problem in Mathematica
  • Previous by thread: FW: Accuracy problem in Mathematica
  • Next by thread: Re: Combining two paramteric plots into one.