MathGroup Archive 2004

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

Search the Archive

Re: PlotLabel with assigned variables *and* on several lines

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49019] Re: PlotLabel with assigned variables *and* on several lines
  • From: Alain Cochard <alain at geophysik.uni-muenchen.de>
  • Date: Tue, 29 Jun 2004 04:49:45 -0400 (EDT)
  • References: <f4.3ce55f57.2e115b8e@aol.com>
  • Reply-to: alain at geophysik.uni-muenchen.de
  • Sender: owner-wri-mathgroup at wolfram.com

BobHanlon at aol.com writes:

 > > alain at geophysik.uni-muenchen.de
 > > 
 > > By searching the archives I found how to write variables with
 > > specific values.  E.g., the following examples work:
 > > 
 > >      In[253]:= a=1;b=2; Plot[ Sin[x],{x,0, PlotLabel->"a=" <>
 > > ToString[a] "b=" <> ToString[b] ]
 > > 
 > >      In[254]:= a=1;b=2; Plot[ Sin[x],{x,0,1},PlotLabel->SequenceForm 
 > > ["a=",a,"b=",b]]
 > > 
 > > 
 > > Then I also found how to write a label on several lines:
 > > 
 > >      In[256]:= Plot[ Sin[x],{x,0,1},PlotLabel->"2 \n lines"]
 > > 
 > > 
 > > But I did not find or succeed in combining the two.   E.g., those do
 > > not work:
 > > 
 > >      In[255]:= a=1;b=2; Plot[ Sin[x],{x,0,1},PlotLabel->"a=" <>
 > > ToString[a] \n "b=" <> ToString[b] ]
 > > 
 > >      In[264]:= a=1;b=2; Plot[ Sin[x],{x,0,1},PlotLabel->
 > > SequenceForm["a=",a,\n" b=",b]]
 > > 
 > >      In[264]:= a=1;b=2; Plot[
 > > Sin[x],{x,0,1},PlotLabel->SequenceForm["a=",a] \n
 > > SequenceForm["b=",b]]
 > > 
 > > Is there a way to achieve this goal?

 > The newline (\n) needs to be in the string.
 > 
 > a=1;b=2; Plot[ Sin[x],{x,0,1},
 >    PlotLabel->"a=" <> ToString[a]   <> "\nb=" <> ToString[b] ];
 > 
 > 
 > Plot[ Sin[x],{x,0,1},PlotLabel->SequenceForm["a=",a,"\nb=",b]];
 > 
 > 
 > Bob Hanlon


Thanks a lot.  For me (version 4.0), your first example works as
desired, while for the second one, the 'b' string is indeed on the
second line, but the actual value of 'b' remains on the first one.  

AC



  • Prev by Date: Re: Mathematica on Linux
  • Next by Date: Re: Equation - problem
  • Previous by thread: Re: PlotLabel with assigned variables *and* on several lines
  • Next by thread: RE: PlotLabel with assigned variables *and* on several lines