[Date Index]
[Thread Index]
[Author Index]
Re: Plot axis numbers
*To*: mathgroup at smc.vnet.net
*Subject*: [mg56803] Re: [mg56748] Plot axis numbers
*From*: "David Park" <djmp at earthlink.net>
*Date*: Fri, 6 May 2005 03:00:32 -0400 (EDT)
*Sender*: owner-wri-mathgroup at wolfram.com
Torquil,
I'm not certain how you got a plot that had those particular y axis tick
labels. In any case, you would have to fiddle with FrameTicks to obtain the
formatting you want for the numbers.
Here is a similar example.
nformat = NumberForm[#, {3, 2}, NumberPadding -> {"", "0"}] &;
Plot[Sqrt[x], {x, 0, 2.5},
Frame -> True,
FrameTicks -> {Table[{x, nformat[x]}, {x, 0, 2.5, 0.5}],
Table[{y, nformat[y]}, {y, 0, 1.5, 0.25}], None, None},
ImageSize -> 450];
The only trouble with this is that the small ticks are lost and there are no
tick marks on the upper and right hand side of the frame. It would take much
more work to get all of those correctly.
With DrawGraphics from my web site below, you can use the CustomTicks
function to generate the tick marks. (You could even make the tick values a
function of the actual plot positions.) Here is the same example with small
ticks and unlabeled ticks on the top and right.
nformat = NumberForm[#, {3, 2}, NumberPadding -> {"", "0"}] &;
Draw2D[
{Draw[Sqrt[x], {x, 0, 2.5}]},
Frame -> True,
FrameTicks ->
{CustomTicks[Identity, {0, 2.5, 0.5, 5}, CTNumberFunction -> nformat],
CustomTicks[Identity, {0, 1.5, 0.25, 5}, CTNumberFunction -> nformat],
CustomTicks[Identity, {0, 2.5, 0.5, 5}, CTNumberFunction -> ("" &)],
CustomTicks[Identity, {0, 1.5, 0.25, 5}, CTNumberFunction -> ("" &)]},
Background -> Linen,
ImageSize -> 450];
The number function ""& simply eliminates the display of the tick value. The
lists in CustomTicks are {starting value, ending value, increment, number of
intervals for small ticks}.
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: Torquil MacDonald Sørensen [mailto:torquil at frisurf.no]
To: mathgroup at smc.vnet.net
Greetings!
In short:
How can I ensure that all numbers on the plot axes have the same number
of digits?
If e.g. the y-axis in a plot goes from 0 to 1 in steps of 0.25, then the
axis numbers will be e.g 0.25 and 0.5. I want this to be 0.25 and
0.50. Any suggestions other than manually adjusting the numbers with the
FrameTicks option?
- T.M.Sørensen
(Mathematica 5)
Prev by Date:
**Re: letrec/named let**
Next by Date:
**Re: Re: Variant of inner Product ...**
Previous by thread:
**Re: Plot axis numbers**
Next by thread:
**ZTarnsform[Sin[4 n],n,z] OK, but ZTransform[Sin[5 n],n,z,] hangs?**
| |