MathGroup Archive 2008

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

Search the Archive

Re: changing the NumberForm of Automatic Plot Ticks

  • To: mathgroup at smc.vnet.net
  • Subject: [mg90694] Re: changing the NumberForm of Automatic Plot Ticks
  • From: "David Park" <djmpark at comcast.net>
  • Date: Sat, 19 Jul 2008 04:51:35 -0400 (EDT)
  • References: <g5piv6$qas$1@smc.vnet.net>

Using the Presentations package you could do something like the following 
with the CustomTicks function:

Needs["Presentations`Master`"]

bigdollar[value_] :=
 If[value >= 0,
  Row[{"$", NumberForm[value // N, 4], "M"}],
  Row[{"-$", NumberForm[-value // N, 4], "M"}]]

yticks = CustomTicks[10^6 # &, {-200, 200, 100, 5},
   CTNumberFunction -> bigdollar];

Plot[200*^6 Sin[t], {t, 0, 2 \[Pi]},
 Frame -> True,
 FrameTicks -> {{yticks, yticks // NoTickLabels}, {Automatic,
    Automatic}},
 PlotLabel -> "My Net Worth During the Political Cycle"]


-- 
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/


"Stern" <nycstern at gmail.com> wrote in message 
news:g5piv6$qas$1 at smc.vnet.net...
> When using Mathematica to analyze financial problems, I often create 
> graphs
> in which the Y axis describes amounts of money. These are typically large
> enough that Mathematica switches to scientific notation (that is, 2.7x10^8
> rather than $270,000,000). I can force the latter with a custom Ticks
> function (Table[{i,"$" <> ToString[NumberForm[i, DigitBlock -> 3,
> ExponentFunction -> (Null &)], etc.) but this becomes inelegant when it's
> buried inside a Manipulate call and the range and spacing of the ticks are
> changing. Is there some straightforward way to change the formatting of
> these tick numbers?
>
> Thanks,
>
> Michael Stern
> 



  • Prev by Date: Re: Corrupt graphics output
  • Next by Date: Re: Corrupt graphics output
  • Previous by thread: changing the NumberForm of Automatic Plot Ticks
  • Next by thread: Spreadsheet like input