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] ====