MathGroup Archive 2006

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

Search the Archive

RE: Tick mark function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg68158] RE: [mg68134] Tick mark function
  • From: "David Park" <djmp at earthlink.net>
  • Date: Wed, 26 Jul 2006 02:26:22 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

The standard package Graphics`Graphics` has a function LinearScale that will
generate 'nice' values for tick marks within a given interval. You could
find the maximum (I assume the minimums are all zero?) x value of each set
of data, use LinearScale to get a nice values and then pick off the last
one. Something like the following.

Needs["Graphics`Graphics`"]

data = Table[{x, x + Sin[x]/5}, {x, 0, 6.23, 6.23/25}];

Module[{maxval, xticks},
  maxval = Max@Part[Transpose[data], 1];
  xticks = Take[LinearScale[0, maxval], -1];
  Show[Graphics[
      {AbsolutePointSize[4],
        Point /@ data,
        Line[data]}],
    Frame -> True,
    FrameTicks -> {xticks, Automatic, None, None}]

Or, if you don't mind having a decimal number for the tick mark you could
simply use the last value directly. Or add some number formatting to control
the number of places.

Module[{maxval, xticks},
  maxval = Max@Part[Transpose[data], 1];
  xticks = {{maxval, NumberForm[maxval, {2, 1}]}};
  Show[Graphics[
      {AbsolutePointSize[4],
        Point /@ data,
        Red, Line[data]}],
    Frame -> True,
    FrameTicks -> {xticks, Automatic, None, None}]

It would be interesting to know what your graphical message is and what your
various data sets actually look like. Are the x domains wildly disparate?
Are you actually trying to compare different sets of data? A GraphicsArray
is not always an efficient or informative method of presenting information.

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/



From: D. Grady [mailto:D.C.Grady at gmail.com]
To: mathgroup at smc.vnet.net


I'm working on a problem that involves creating a large group of
ListPlots, and the scales of the individual plots are not necessarily
similar.  When displaying these plots together in a GraphicsArray, the
tick mark values on the plot axes can be bunched so tightly that they
are illegible.  What I would like to do is display a single tick mark
on each axis at the maximum value of the axis.  In the documentation
for Ticks, it says that you can supply a "function to be applied to
x_min, x_max to get the tick mark option," but I've been unsuccesful in
getting this to work.  I've tried

Ticks->{Max[#1,#2]&,None}
Ticks->{Max[#]&,None}
Ticks->{Max,None}

to no avail.  Does anyone know how this setting for Ticks is intended
to function?  I have spent some time going through the group archives
and found many references to the DrawGraphics package which includes a
CustomTicks function; if all else fails I'm sure that would be a
solution, but I was hoping for something more straightforward.  Thanks
in advance!



  • Prev by Date: Re: Wolfram Workbench
  • Next by Date: Re: Wolfram Workbench
  • Previous by thread: Re: Tick mark function
  • Next by thread: Re: Tick mark function