MathGroup Archive 2002

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

Search the Archive

Re: Tick marks at frame edges

  • To: mathgroup at smc.vnet.net
  • Subject: [mg32280] Re: [mg32235] Tick marks at frame edges
  • From: Omega Consulting <omega_consulting at yahoo.com>
  • Date: Wed, 9 Jan 2002 23:38:02 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

At 02:17 AM 1/9/2002, Jun Lin wrote:
>I tend to plot a curve, y=y(x), where x is also a function of another
>variable, t, x=x(t). So, I want to arrange this curve in a frame such
>that the lower edge of the frame is tick-marked according to t, say
>from 0 to 1, and that the upper edge of the frame is tick-marked
>according to x, say from x(t=0) to x(t=1). I am appreciating with any
>help.
>
>Jun Lin

Here's an example.

y[x_]=x^2;
x[t_]=t^2;

Do a plot where the t and y sides are labeled.

gr=Plot[y[x[t]],{t,0,1},Frame->True]

The first set of ticks are for the t side.

tticks=First[FullOptions[gr,FrameTicks]];

Labeled ticks are of the form {location, label, other stuff}. To get the 
ticks for the x side, we just need to change the labels from the t side.

xticks=tticks/.{t_Real,t_Real,rest__}:>{t,x[t],rest};

Then we re-Plot with the new ticks.

Plot[y[x[t]],{t,0,1},Frame->True,
     FrameTicks->{Automatic,Automatic,xticks,Automatic}]

An alternative is to keep the labels the same and move the ticks. This can 
be done if you use the inverse of x[t].

xinv[t_]=Sqrt[t];

xinvticks=tticks/.{t_Real,label_,rest__}:>{xinv[t],label,rest};

Plot[y[x[t]],{t,0,1},Frame->True,
     FrameTicks->{Automatic,Automatic,xinvticks,Automatic}]

--------------------------------------------------------------
Omega Consulting
"The final answer to your Mathematica needs"

Spend less time searching and more time finding.
http://www.wz.com/internet/Mathematica.html



  • Prev by Date: RE: Plot2D: How to attach names to plotted functions
  • Next by Date: Re: Holding Arguments in a Second Argument List
  • Previous by thread: Re: Tick marks at frame edges
  • Next by thread: RE: Tick marks at frame edges