MathGroup Archive 2009

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

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg105423] Re: [mg105402] Combine images, Show[] and its effect on AspectRatio. Plot, Epilog, Circle, Arc
  • From: "David Park" <djmpark at comcast.net>
  • Date: Wed, 2 Dec 2009 06:25:27 -0500 (EST)
  • References: <21846985.1259661676177.JavaMail.root@n11>

Nasser,

The problem with the replies I saw this morning is that the arc is still not
circular. That is because (I think) AspectRatio does not refer to the Frame
of the plot but to the overall plot box that also contains the tick labels.
This makes it more difficult and you have to guess at the proper circle
scaling.

The following is a Presentations solution that uses an Automatic
AspectRatio, which gets the Circle right, then stretches the Sin curve to
give the approximate appearance it would have with a 1/GoldenRatio
AspectRatio, and then uses CustomTicks to put the correct y ticks on the
plot.

Needs["Presentations`Master`"]

yticks = CustomTicks[GoldenRatio # &, {-1, 1, .5, 5}];
Draw2D[
 {Draw[GoldenRatio Sin[x], {x, -\[Pi], \[Pi]}],
  Circle[{0, 0}, 1, {-45 Degree, 180 Degree}]},
 AspectRatio -> Automatic,
 Frame -> True,
 FrameTicks -> {{yticks, yticks // NoTickLabels}, {Automatic, 
    Automatic}},
 ImageSize -> 400]


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/  


From: Nasser M. Abbasi [mailto:nma at 12000.org] 

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





  • Prev by Date: Build matrices iteratively with functional constructs
  • Next by Date: Re: Re: Using GraphPlot to draw an empty graph
  • Previous by thread: Re: Combine images, Show[] and its effect on AspectRatio. Plot, Epilog, Circle, Arc
  • Next by thread: Re: piecewice pdf, problems with cdf