|
[Date Index]
[Thread Index]
[Author Index]
RE: Uneven FrameTicks with ExtendGraphics
- To: mathgroup at smc.vnet.net
- Subject: [mg36586] RE: [mg36560] Uneven FrameTicks with ExtendGraphics
- From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.com>
- Date: Fri, 13 Sep 2002 01:13:55 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
>-----Original Message-----
>From: Tom Aldenberg [mailto:Tom.Aldenberg at rivm.nl]
To: mathgroup at smc.vnet.net
>Sent: Wednesday, September 11, 2002 7:28 PM
>Subject: [mg36586] [mg36560] Uneven FrameTicks with ExtendGraphics
>
>
>Dear MathGroup,
>
>To plot FrameTicks outward with the same style as the Frame, I use
>ExtendGraphics in the following way.
>
>Needs["ExtendGraphics`Ticks`"];
>
>tf[min_,max_] := TickFunction[min, max, MajorStyle ->
>{Thickness[0.003]},
> MajorLength - > {0, 0.01}, MinorStyle -> {Thickness[0.003]},
>MinorLength -> {0, 0.005}]
>
>Plot [-2.4 (x+6) (x-8), {x, -6.2, 9.2}, FrameTicks -> {tf, tf,
>None, None},
>AspectRatio -> 18/25, Frame -> True, DefaultFont ->
>{"Helvetica-Bold", 12},
>Axes -> None,
>FrameStyle -> Thickness[0.003], FrameLabel -> {"x", "y", None, None},
>PlotStyle -> Thickness[0.006],
>ImageSize -> 504];
>
>(instead of the same Plot statement with FrameTicks -> {Automatic,
>Automatic, None, None})
>
>This arrangement of major and minor ticks is clearly unacceptable. The
>minor ticks do not divide
> intervals of adjacent labelled major ticks into equal parts.
>
>Are there other solutions? I have noticed that some major statistical
>(plotting) programs don't do minor ticks at all.
>
>Tom Aldenberg
>RIVM
>Bilthoven
>Netherlands
>
>
Several alternatives (if the default ticks of Plot, Show that is, wouldn't
do):
(1) generate the ticks explicitly (to get control over supplied min, max
values for TickFunction):
yticks = tf[-40., 120.]
xticks = tf[-6.2, 9.2]
Plot[-2.4 (x + 6) (x - 8), {x, -6.2, 9.2},
FrameTicks -> {xticks, yticks, None, None}, ...]
(2) try the Option TickNumbers, e.g.
tf[min_, max_] :=
TickFunction[min, max, MajorStyle -> {Thickness[0.005]},
MajorLength -> {0, 0.01}, MinorStyle -> {Thickness[0.003]},
MinorLength -> {0, 0.005}, TickNumbers -> {5, 25}]
gives an acceptable result, or TickNumbers -> {6, 18};
with TickNumbers -> {8, 8} you'll have no minor ticks.
(3) redefine the tick function's helper
Begin["ExtendGraphics`Ticks`Private`"]
?? TickPosition
"TickPosition[ min, max, num] returns a list of at most num nicely rounded
positions between min and max. These can be used for tick mark positions."
TickPosition[x0_Real, x1_Real, (num_Integer)?Positive] :=
Block[{dist, scale, min, max, i, delta, space},
space = {1., 2., 2.5, 5., 10.}; dist = (x1 - x0)/num;
scale = 10.^Floor[Log[10, dist]]; dist = dist/scale;
If[dist < 1., dist *= 10.; scale /= 10.];
If[dist >= 10., dist /= 10.; scale *= 10.];
delta = First[Select[space, #1 >= dist & ]]*scale;
min = Ceiling[x0/delta]*delta; Table[Floor[x/delta + 0.5]*delta,
{x, min, x1, delta}]]
End[]
There are some things to play with: space, scale, the definition for delta,
to get at more nicely rounded positions; or rewrite completely.
(4) for best control, define the ticks all by yourself, e.g.
yticks1 = Table[{t, t, {0, 0.01`}, {Thickness[0.003`]}} , {t, -25, 100, 25}]
yticks2 =
DeleteCases[
Table[{t, "", {0, 0.005`}, {Thickness[0.003`]}} , {t, -25, 100,
12.5}], {t_, __} /; Mod[t, 25] == 0]
xticks = Join[xticks1, xticks2]
xticks1 = Table[{t, t, {0, 0.01`}, {Thickness[0.003`]}} , {t, -5, 7.5, 2.5}]
xticks2 =
DeleteCases[
Table[{t, "", {0, 0.005`}, {Thickness[0.003`]}} , {t, -7.5, 8.5,
1.25}], {t_, __} /; Mod[t, 2.5] == 0]
yticks = Join[yticks1, yticks2]
--
Hartmut Wolf
Prev by Date:
RE: Re: : huge number, ciphers after decimal point?
Next by Date:
Re: Empirical CDF and InterpolatingFunction
Previous by thread:
Uneven FrameTicks with ExtendGraphics
Next by thread:
creating adjacency matrices
|