Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: Plot, Epilog, and Text

  • To: mathgroup at smc.vnet.net
  • Subject: [mg80818] Re: Plot, Epilog, and Text
  • From: Bill Rowe <readnewsciv at sbcglobal.net>
  • Date: Mon, 3 Sep 2007 06:10:32 -0400 (EDT)

On 9/2/07 at 2:52 AM, vze269bv at verizon.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.

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

There are two issues that make things different.

First, the second argument to your function g is specified to be 
a Real but when you use it you supply an Integer. That causes g 
to be unevaluated which produces an error.

Second, your function g supplies a third argument to Text, i.e., 
{0,-2} which is an offset outside the range of the bounding rectangle.

Changing the definition of g to be

g[X_String,w_,f_]:=Text[Style[X,12,Bold],{w,f/.{x->w}}]

Will cause both Plot commands to produce the same graphic
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: date format
  • Next by Date: Re: Re: Rule-based programming: declare variables to be a number
  • Previous by thread: Re: Plot, Epilog, and Text
  • Next by thread: BetaRegularized