MathGroup Archive 2007

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

Search the Archive

Re: Arbitrarily formatted text in plot labels

  • To: mathgroup at smc.vnet.net
  • Subject: [mg79300] Re: Arbitrarily formatted text in plot labels
  • From: yatesd at mac.com
  • Date: Tue, 24 Jul 2007 06:00:30 -0400 (EDT)
  • References: <f7shug$af$1@smc.vnet.net>

Hi Gareth,

Here are 2 possible solutions. There may well be more elegant ones.
Note firstly that PlotLabel by default displays expressions in
TraditionalForm, so the problem is arising because of the use of Set
and because you want 2 equations separated by a comma. (i.e PlotLabel-
>(r -> rList[[i]]) displays fine (as long as there is no definition
for r), it just doesn't happen to be what you want.)

Solution (1)
PlotLabel->(With[{rL=rList[[i]], sL=sList[[j]]},
Row[{HoldForm[r=rL],",   ",HoldForm[s=sL]}]])

'With' is very handy for this type of thing. I imagine With evaluating
its constants (i.e. rL and sL here) and then 'pasting' them into the
body. This allows one to paste the value of something inside a Hold (I
used HoldForm here so that we would not see the Hold function in the
output). The help to With gives a few other good examples.
Note that Row is new to Version 6. You could probably achieve a
similar thing with TableForm and then play around with the column
spacing.

Solution (2)
PlotLabel->DisplayForm[RowBox[{"r=", rList[[i]]  ,  ", "  ,  "s=",
sList[[j]]  }]]
This does not use any Version 6 functions. It essentially jumps to a
similar low level expression as what gets created by Solution (1). It
also seems to do a better job with the spacing. RowBox is a fairly low
level function though, and not everybody is familiar with it.

Hope that helps.

Regards,

Derek



  • Prev by Date: Re: Heat transfer -- possible in mathematica?
  • Next by Date: Re: Locator question
  • Previous by thread: Arbitrarily formatted text in plot labels
  • Next by thread: HoldCompleteForm (or HoldFormComplete)