MathGroup Archive 2003

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

Search the Archive

Re: Re: Re: format Text in graphics

  • To: mathgroup at smc.vnet.net
  • Subject: [mg42288] Re: [mg42274] Re: [mg42260] Re: [mg42251] format Text in graphics
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Fri, 27 Jun 2003 06:31:18 -0400 (EDT)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <200306250950.FAA04042@smc.vnet.net> <5.0.0.25.0.20030626081751.01d2f598@pop.wolfram.com>
  • Reply-to: murray at math.umass.edu
  • Sender: owner-wri-mathgroup at wolfram.com

Yes, your approach definitely gives correct results.  But it is 
incredibly verbose and tedious to do, requiring essentially individual 
formatting of each character in the text string.

Surely a really satisfactory solution would take advantage of 
Mathematica's heuristics for formatting in TraditionalForm (so one does 
not, in effect, have to reinvent that for each specific text string that 
one wants to place in a graphic).

I still cannot believe there is no _simple_ way to do this!

Omega Consulting wrote:
> I think there is a simpler way to do this. There is a nice feature that 
> styles applied inside strings will be used in the graph. Start with a 
> plain string.
> 
> Plot[Sin[x], {x, 0, 2Pi},
>     Epilog -> {Text["y=f(x)", {Pi, 1/2}]}];
> 
> Then select characters inside the string and add font features (italics, 
> fontfamily, etc.). The following is a step in the right direction. (It's 
> pretty ugly here, but paste it in the frontend and it should look fine.)
> 
> Plot[Sin[x], {x, 0, 2Pi},
>     Epilog -> {Text["\!\(\*
> StyleBox[\"y\",\nFontFamily->\"Times New 
> Roman\",\nFontSlant->\"Italic\"]\)\!\
> \(\*
> StyleBox[\"=\",\nFontFamily->\"Times New Roman\"]\)\!\(\*
> StyleBox[\"f\",\nFontFamily->\"Times New 
> Roman\",\nFontSlant->\"Italic\"]\)\!\
> \(\*
> StyleBox[\"(\",\nFontFamily->\"Times New Roman\"]\)\!\(\*
> StyleBox[\"x\",\nFontFamily->\"Times New 
> Roman\",\nFontSlant->\"Italic\"]\)\!\
> \(\*
> StyleBox[\")\",\nFontFamily->\"Times New Roman\"]\)", {Pi, 1/2}]}];
> 
> At 04:36 AM 6/26/2003, Murray Eisenberg wrote:
> 
>> Thanks to all who have replied so far -- and please keep the answers
>> coming!  Perhaps we will at last see a truly simple, straigntforward,
>> robust, and correct way to accomplish what seems such a basic task for
>> annotating graphics!
>>
>> So far, the solution below -- with the proposer's subsequent (privately
>> sent) amendment to wrap y and f[x] with HoldForm -- seems to be the only
>> one that actually works in the sense I indicated.
>>
>> There still seems to be no general solution that would also properly
>> format, in conventional form, other math expressions as Text in graphics
>> output.
>> >
>> >
>> >>From: Murray Eisenberg <murray at math.umass.edu>
To: mathgroup at smc.vnet.net
>> To: mathgroup at smc.vnet.net
>> >
>> > To: mathgroup at smc.vnet.net
>> >
>> >>Organization: Mathematics & Statistics, Univ. of Mass./Amherst
>> >>Reply-To: murray at math.umass.edu
>> >>Date: Wed, 25 Jun 2003 01:53:47 -0400 (EDT)
>> >>To: mathgroup at smc.vnet.net
>> >>Subject: [mg42288] [mg42274] [mg42260] [mg42251] format Text in graphics
>> >>
>> >>What value of Epilog in a Plot expression will properly format
>> >>
>> >>y = f(x)
>> >>
>> >>in conventional mathematical style?  That is, the y, f, and x should be
>> >>italicized but the = and parentheses should not.
>> >>
>> >>Some things that do NOT work:
>> >>
>> >>Epilog -> Text[TraditionalForm[y = f(x)], {0.5, 0.5}]
>> >>
>> >>(* that just sets y to be f(x) and then displays f(x) *)
>> >>
>> >>textForm[txt_] := StyleForm[txt, FontFamily -> Times]
>> >>mathForm[txt_] := StyleForm[txt, FontFamily -> Times, FontSlant -> 
>> Italic]
>> >>
>> >>Epilog -> Text[mathForm["y "], textForm["="], mathForm[" f(x)"], 
>> {0.5 0.5}]
>> >>
>> >>(* SOMETHING like the preceding should work, but I don't see how to
>> >>combine the three StyleForm results *)
>> >>
>> >>--
>> >>Reply to "REPLY TO" address and NOT to the "FROM" address!!
>> >>Otherwise I will never see your reply!!!!!!!!!!!!!!!!!!!!!!
>> >>
>> >>Murray Eisenberg                     murray at math.umass.edu
>> >>Mathematics & Statistics Dept.
>> >>Lederle Graduate Research Tower      phone 413 549-1020 (H)
>> >>University of Massachusetts                413 545-2859 (W)
>> >>710 North Pleasant Street            fax   413 545-1801
>> >>Amherst, MA 01003-9305
>> >>
>> >
>> >
>> >
>>
>> -- 
>> Reply to "REPLY TO" address and NOT to the "FROM" address!!
>> Otherwise I will never see your reply!!!!!!!!!!!!!!!!!!!!!!
>>
>> Murray Eisenberg                     murray at math.umass.edu
>> Mathematics & Statistics Dept.
>> Lederle Graduate Research Tower      phone 413 549-1020 (H)
>> University of Massachusetts                413 545-2859 (W)
>> 710 North Pleasant Street            fax   413 545-1801
>> Amherst, MA 01003-9305
> 
> 
> --------------------------------------------------------------
> Omega Consulting
> "The final answer to your Mathematica needs"
> http://omegaconsultinggroup.com
> 
> 

-- 
Reply to "REPLY TO" address and NOT to the "FROM" address!!
Otherwise I will never see your reply!!!!!!!!!!!!!!!!!!!!!!

Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305


  • Prev by Date: Re: Re: Re: format Text in graphics
  • Next by Date: Re: Re: Re: format Text in graphics
  • Previous by thread: Re: Re: Re: Re: format Text in graphics
  • Next by thread: Re: format Text in graphics