RE: Tick marks at frame edges
- To: mathgroup at smc.vnet.net
- Subject: [mg32274] RE: [mg32235] Tick marks at frame edges
- From: "David Park" <djmp at earthlink.net>
- Date: Wed, 9 Jan 2002 23:37:46 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Jun Lin,
Using the CustomTicks command in the DrawGraphics package, available at my
web site, this is fairly easy. Here is an example:
Needs["DrawGraphics`DrawingMaster`"]
f[t_] := t^2
Draw2D[
{Draw[Sin[f[t]], {t, 0, 2}]},
Frame -> True,
FrameTicks -> {Automatic, Automatic,
CustomTicks[Sqrt[#1] & , {0, 4, 1, 4}],
Automatic}];
The lower tick marks are now evenly spaced and go from 0 to 2. The upper
tick marks are quadratically spaced and go from 0 to 4 in steps of 1 with 4
subdivisions. The first argument in CustomTicks is a pure function that maps
from the tick value to the actual plot coordinate, in this case the inverse
of f.
Evaluating the CustomTicks command and pasting it directly into a regular
Plot statement I get a form you can evaluate without DrawGraphics.
Plot[Sin[f[t]], {t, 0, 2}, Frame -> True,
FrameTicks -> {Automatic, Automatic,
{{0, 0, {0.00625, 0}, {}}, {1, 1, {0.00625, 0},
{}}, {Sqrt[2], 2, {0.00625, 0}, {}},
{Sqrt[3], 3, {0.00625, 0}, {}},
{2, 4, {0.00625, 0}, {}}, {1/2, "", {0.00375, 0},
{}}, {1/Sqrt[2], "", {0.00375, 0}, {}},
{Sqrt[3]/2, "", {0.00375, 0}, {}},
{Sqrt[5]/2, "", {0.00375, 0}, {}},
{Sqrt[3/2], "", {0.00375, 0}, {}},
{Sqrt[7]/2, "", {0.00375, 0}, {}},
{3/2, "", {0.00375, 0}, {}}, {Sqrt[5/2], "",
{0.00375, 0}, {}}, {Sqrt[11]/2, "", {0.00375, 0},
{}}, {Sqrt[13]/2, "", {0.00375, 0}, {}},
{Sqrt[7/2], "", {0.00375, 0}, {}},
{Sqrt[15]/2, "", {0.00375, 0}, {}}}, Automatic}];
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
> From: Jun Lin [mailto:jl_03824 at yahoo.com]
To: mathgroup at smc.vnet.net
>
>
> 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
>