MathGroup Archive 2009

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

Search the Archive

Re: Combine images, Show[] and its effect on AspectRatio. Plot, Epilog,

  • To: mathgroup at smc.vnet.net
  • Subject: [mg105417] Re: Combine images, Show[] and its effect on AspectRatio. Plot, Epilog,
  • From: dh <dh at metrohm.com>
  • Date: Tue, 1 Dec 2009 06:28:21 -0500 (EST)
  • References: <hf2mqp$id6$1@smc.vnet.net>


Nasser M. Abbasi wrote:

> Hello,

> 

> This is Version 7, Windows.

> 

> I make a plot and Mathematica seems to have a good algorithm for coming up 

> with an AspectRatio which makes the plot looks good. So when I type

> 

> p=Plot[Sin[x],{x,-Pi,Pi}];

> AspectRatio/.FullOptions[p]

> 0.618034

> 

> Now, I wanted to add an arc on top of the above plot at some place, say the 

> origin, so I type

> 

> p=Plot[Sin[x],{x,-Pi,Pi},Epilog->Circle[{0,0},.5,{-45 Degree,180 Degree}]];

> AspectRatio/.FullOptions[p]

> Out[67]= 0.618034

> Show[p]

> 

> But due to the aspect ratio used for the Plot itself, you can see that the 

> arc is not circular as I expected. So now I typed

> 

> p=Plot[Sin[x],{x,-Pi,Pi},AspectRatio->Automatic,Epilog->Circle[{0,0},.5,{-45 

> Degree,180 Degree}]];

> AspectRatio/.FullOptions[p]

> 0.31831

> Show[p]

> 

> Now, the arc is seen as circular, but I lost the good aspect ratio which 

> made my Plot look good.

> 

> So, I was trying to find how to keep the original Aspect ratio for the plot, 

> but keep the arc come up as circular and not turn to some sort of elliptic 

> shape as would be the case without the use of Automatic.

> 

> I also tried Show[g1,g2] but depending on the order, the AspectRatio changes 

> (because Show[] uses information from the first object). So that did not 

> help.

> 

> So, my problem is that I need to make the plot using the Mathematica 

> calculated AspectRatio, but also add an or circle and make that show as a 

> circle on the top of the earlier plot, and not have its AspectRatio changed 

> by adding the new object. Using AspectRatio->Automatic is not an option, as 

> it made my overall plot look not good.

> 

> Graphics[]  has 100's of options, and I am looking at them now, may be there 

> is something hidden there, but I am not seeing anything yet.

> 

> Thanks

> --Nasser

> 

> 

Hi Nasser,

the circle is drawn in the coordinate system of the plot. Therefore, you 

need to draw the circle as an ellipss in the "Plot" coordinate system. 

This can be done by a scaling transformation that takes care of the 

aspect ratio:



cir = Circle[{0, 0}, 1, {-45 Degree, 180 Degree}];

pl = Plot[Sin[x], {x, -Pi, Pi}];

asp = AspectRatio /. FullOptions[pl];

tr = ScalingTransform[{1/asp, 1}];

cir = Graphics@GeometricTransformation[cir, tr];

Show[pl, cir]




  • Prev by Date: Re: By Reference
  • Next by Date: Re: By Reference
  • Previous by thread: NDSolve: Affecting dependent variable during solution?
  • Next by thread: Re: Combine images, Show[] and its effect on AspectRatio. Plot, Epilog,