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: [mg49021] RE: [mg49000] PlotLabel with assigned variables *and* on several lines
  • From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.com>
  • Date: Tue, 29 Jun 2004 04:49:47 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com
  • Thread-topic: [mg49000] PlotLabel with assigned variables *and* on several lines

Alain,

>
>Is there a way to achieve this goal?
>
yes, all your ideas work, after their syntax having been brushed up a bit (see below inline):

Hartmut Wolf


>-----Original Message-----
>From: Alain Cochard [mailto:alain at geophysik.uni-muenchen.de]
To: mathgroup at smc.vnet.net
>Sent: Monday, June 28, 2004 10:14 AM
>To: mathgroup at smc.vnet.net
>Subject: [mg49021] [mg49000] PlotLabel with assigned variables *and* on several
>lines
>
>
>Hello.  
>
>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,1},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] ]
>
>    Syntax::sntxf: "a=1;b=2; Plot[ 
>Sin[x],{x,0,1},PlotLabel->"a=" <> ToString[a"
>     cannot be followed by "]\n"b=" <> ToString[b] ]".


a = 1; b = 2; Plot[Sin[x], {x, 0, 1}, 
  PlotLabel -> "a=" <> ToString[a] <> "\nb=" <> ToString[b]]

(*  \n is a character  *)


>
>    In[264]:= a=1;b=2; Plot[ 
>Sin[x],{x,0,1},PlotLabel->SequenceForm["a=",a,\n" b=",b]]
>
>    Syntax::com: Warning: comma encountered with no adjacent 
>expression; the
>	 expression will be treated as Null. 
>
>
>    Syntax::sntxf: "a=1;b=2; Plot[ 
>Sin[x],{x,0,1},PlotLabel->SequenceForm ["a=",a"
>	 cannot be followed by ",\n"b=",b]]".


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]]
>
>    Syntax::sntxf: "a=1;b=2; Plot[ 
>Sin[x],{x,0,1},PlotLabel->SequenceForm["a=",a]"
>	 cannot be followed by " \n SequenceForm["b=",b]]".
>


a = 1; b = 2; Plot[Sin[x], {x, 0, 1}, 
  PlotLabel -> ColumnForm[{SequenceForm["a=", a] , SequenceForm["b=", b]}]]


>Thanks in advance,
>AC
>
>


  • Prev by Date: RE: options Transpose[] ?
  • Next by Date: RE: one question about draw graph in frame
  • Previous by thread: Re: PlotLabel with assigned variables *and* on several lines
  • Next by thread: Simple question