Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*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 2005

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

Search the Archive

Re: Changing Ticks to Rationals

  • To: mathgroup at smc.vnet.net
  • Subject: [mg60724] Re: Changing Ticks to Rationals
  • From: Peter Pein <petsie at dordos.net>
  • Date: Mon, 26 Sep 2005 01:36:04 -0400 (EDT)
  • References: <dh5rj5$ho8$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

kristoph schrieb:
> Is it possible to change the ticks in an Histogram to rationals?
> For example:
> Changing 2.5 to 5/2 and so on. Thanks for help.
> 

In[1]:=
data = Table[Random[], {123}];
In[2]:=
hg = Block[{$DisplayFunction = #1 & }, Histogram[data]];
In[3]:=
Show[hg, Ticks -> (Ticks /. AbsoluteOptions[hg] /.
  {x_Real, x_Real, more__} :> {x, Rationalize[x, 1/100], more}),
   ImageSize -> 555];

-- 
Peter Pein, Berlin
GnuPG Key ID: 0xA34C5A82
http://people.freenet.de/Peter_Berlin/


  • Prev by Date: Plotting and getting data points
  • Next by Date: Re: Changing Ticks to Rationals
  • Previous by thread: Re: Changing Ticks to Rationals
  • Next by thread: Re: Changing Ticks to Rationals