Re: Combine images, Show[] and its effect on AspectRatio. Plot, Epilog,
- To: mathgroup at smc.vnet.net
- Subject: [mg105430] Re: Combine images, Show[] and its effect on AspectRatio. Plot, Epilog,
- From: Albert Retey <awnl at gmx-topmail.de>
- Date: Wed, 2 Dec 2009 06:26:51 -0500 (EST)
- References: <hf2mqp$id6$1@smc.vnet.net>
Nasser M. Abbasi schrieb:
> 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.
I think that the main problem is that you want the line to look like a
circle, not to be a circle in the coordinates of the plot. So you need
to use Scaled, along with the scaling others have suggested:
p = Plot[Sin[x], {x, -Pi, Pi},
Epilog ->
Circle[{0, 0},
Scaled[0.25 {1/GoldenRatio, 1}], {-45 Degree, 180 Degree}]]
of course you could also use AbsoluteOptions to find the actual
AspectRatio and to the scaling with that value....
hth,
albert