Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1996
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1996

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

Search the Archive

Re: Whole numbers only on x-axis?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg3977] Re: [mg3901] Whole numbers only on x-axis?
  • From: John Fultz <jfultz>
  • Date: Mon, 13 May 1996 01:48:52 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

> Hi,
> 	I am combining a list-plot, where the data points all have
> integers for their x-points, and a continuous plot.  However, the
> "automatic" labeling of the x-axis values is generating fractions,
> such as "12.5".  I would like the x-axis value labels to only be whole
> numbers (e.g., "12"), yet do not see a way to specify this to
> mathematica.  Can anyone help (please-email)?
> 
> thanks,
> Brad
> 
> bmiller at uiuc.edu

Try this:

Needs["Graphics`Graphics`"]

myScale[x_,y_] := UnitScale[x, y, 1]
ListPlot[data, Ticks->{myScale, myScale}]

UnitScale is an undocumented function in Graphics`Graphics` which
automagically generates tick marks, but the units used for tick marks
never get smaller then the third argument (in this case 1, so you never
get a .5 unit).  Similar functions are available for other such
scales...PiScale and LogScale come to mind (although they do not take a
third argument and should be passed directly into Ticks).  Check out
Vol. 5, Iss. 2 of the Mathematica Journal (pages 42-4) for more
information.

						-John

==== [MESSAGE SEPARATOR] ====


  • Prev by Date: packages-notebooks
  • Next by Date: Re: Context Names Question
  • Previous by thread: Whole numbers only on x-axis?
  • Next by thread: Context Names Question