Re: Plot, Epilog, and Text

*To*: mathgroup at smc.vnet.net*Subject*: [mg80814] Re: Plot, Epilog, and Text*From*: Szabolcs <szhorvat at gmail.com>*Date*: Mon, 3 Sep 2007 06:08:29 -0400 (EDT)*Organization*: University of Bergen*References*: <fbdmo6$pat$1@smc.twtelecom.net>

Bruce Colletti wrote: > Re 6.0.1 under WinXP. > > Why does the first Plot fail but not the second? > > They seem equivalent: the former simply uses a function to implement the Text command that is explicit in the second Plot. > > Thankx. > > Bruce > > f=PDF[NormalDistribution[3,Sqrt[6]],x]; > g[X_String,w_Real,f_]:=Text[Style[X,12,Bold],{w,f/.{x->w}},{0,-2}]; > > Clear@x; > Plot[f,{x,-40,40},PlotRange->All,Epilog->{g["X",3,f]}] > > Plot[f,{x,-40,40},PlotRange->All,Epilog->{Text[Style["X",12,Bold],{3,f/.{x->3}}]}] 3 is not a Real, but an Integer, so g["X",3,f] does not match g[X_String, w_Real, f_]. Just use g[x_String, w_?NumericQ, f_] in the function definition. Szabolcs