Re: Re: Combine images, Show[] and its effect on
- To: mathgroup at smc.vnet.net
- Subject: [mg105447] Re: [mg105441] Re: Combine images, Show[] and its effect on
- From: Murray Eisenberg <murray at math.umass.edu>
- Date: Thu, 3 Dec 2009 06:13:45 -0500 (EST)
- Organization: Mathematics & Statistics, Univ. of Mass./Amherst
- References: <hf3086$mpm$1@smc.vnet.net> <200912021129.GAA27129@smc.vnet.net>
- Reply-to: murray at math.umass.edu
A modification of the solution by means of Presentations provided by
David Park will produce the requisite arrow: instead of using the Circle
primitive, use a ParametricDraw and in that replace Line by Arrow:
yticks = CustomTicks[GoldenRatio # &, {-1, 1, .5, 5}];
Draw2D[{Draw[GoldenRatio Sin[x], {x, -\[Pi], \[Pi]}],
ParametricDraw[{Cos[t], Sin[t]}, {t, -45 Degree, 180 Degree}] /.
Line -> Arrow}, AspectRatio -> Automatic, Frame -> True,
FrameTicks -> {{yticks, yticks // NoTickLabels}, {Automatic,
Automatic}}, ImageSize -> 400]
Nasser M. Abbasi wrote:
> Thanks every one for the answers, they helped me understand more about this
> problem.
>
> What I wanted to actually do is to have an arrow at the end of the Arc.
>
> Once I had the Arc looks more circular now (with your help), I found that
> there is no easy way I could add an arrow at the end of the Arc.
>
> So, I ended up making a list of points that traces the shape of the ellipse,
> and then used ListPlot and added an Arrow by using the last 2 points of this
> list of points.
>
> Here is the code:
>
> p = Plot[Sin[x], {x, -Pi, Pi}];
> asp = AspectRatio /. FullOptions[p];
>
> a = 1; b = asp; (* major and minor axis of ellipse *)
>
> (*this below is polar equation for ellipse using origin as center of
> ellipse*)
> r[theta_] := Module[{}, a*(b/Sqrt[(b*Cos[theta])^2 + (a*Sin[theta])^2])]
>
> (* now make points x,y tracing the above ellipse *)
> data = Table[{r[theta]*Cos[theta], r[theta]*Sin[theta]},{theta, -30*Degree,
> 130*Degree, 1*Degree}];
>
> (* now display all, add an arrow at the end of the arc *)
> Show[
> p,
> ListPlot[data, Joined -> True],
> Graphics[ Arrow[{data[[-2]], data[[-1]]}] ]
> ]
>
> But I think what David Park said in his reply is correct, and I quote him
>
> "
> 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 arc is not really circular in shape, but it is more circular than
> without the ellipse transformation trick.
>
> So I ended up, in my other code, having to, by trial and error, find a
> different value for the "b" variable shown above than the one found from the
> AspectRatio of the underlining plot to get the arc to look more circular.
>
> --Nasser
>
>
--
Murray Eisenberg murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305
- References:
- Re: Combine images, Show[] and its effect on
- From: "Nasser M. Abbasi" <nma@12000.org>
- Re: Combine images, Show[] and its effect on