comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Greek and other Symbols in Coyote Graphics
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Greek and other Symbols in Coyote Graphics [message #80968] Fri, 27 July 2012 13:12 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Folks,

As I was answering a question about Coyote Graphics this
morning, it suddenly occurred to me that I knew how to
fix one of the biggest annoyances in the Coyote Graphics
system for me. This is the problem of wanting to use
a Greek or other symbol (an Angstrom symbol, for example)
in a plot or axis title in a command that I've put into
the resizeable graphics window, cgWindow.

I can certainly specify these symbols using cgSymbol, but
the problem is that these symbols need to be evaluated
at run-time, and when you use them as keywords the value
returned by cgSymbol is hard-coded as the keyword value for the
command execution. But, since the symbol code is different
for PostScript than it is for the display, it makes it
very difficult to get PostScript output from cgWindow.
My solution was the clunky "alternative" keyword and
parameter keywords described here:

http://www.idlcoyote.com/cg_tips/kwexpressions.php

You will be happy to hear this nonsense is a thing
of the past! :-)

This morning it occurred to me that I can use the same
"escape sequences" used by Function Graphics to specify
symbols in my Coyote Graphics routines. These escape
sequences prepend a "$\" to the symbol you want to
call with cgSymbol, and append a closing "$".

So, here is the clunky way a cgPlot command would have to be
constructed currently to display properly in a cgWindow
and in an output file with a mu and angstrom symbol:

cgPlot, cgDemoData(1), /Window, $
XTitle='Length (' + cgSymbol('mu') + M)', $
YTitle='Distance (' + cgSymbol('Angstrom') + ')', $
ALT_KEYWORDS={xtitle:'Length (' + cgSymbol('mu', /PS) + M)', $
ytitle:'Distance ('+ cgSymbol('Angstrom', /PS)+')'}

And here is the new way to do this:

cgPlot, cgDemoData(1), /Window, $
XTitle='Length ($\mu$M)', $
YTitle='Distance ($\Angstrom$)'

Quite a bit simpler, yes? :-)

You can find an updated program here with a new ReplaceEscapeSequences
method:

http://www.idlcoyote.com/programs/cgcmdwindow__define.pro

I'll write an article about this change shortly, but this will
work for any of the symbols available in cgSymbol:

http://www.idlcoyote.com/idldoc/cg/cgsymbol.html

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Greek and other Symbols in Coyote Graphics [message #81080 is a reply to message #80968] Thu, 09 August 2012 09:34 Go to previous messageGo to next message
ameigs is currently offline  ameigs
Messages: 12
Registered: March 2009
Junior Member
On Wednesday, August 8, 2012 2:38:49 PM UTC+1, David Fanning wrote:
> ameigs writes:
>
>
>
>> Excellent David. Now how about subscripts and superscripts? Or is that already taken care of?
>
>
>
> I'm not sure I understand what you are asking for. Subscripts
>
> and superscripts can already be embedded into strings with the
>
> normal formatting codes. Nothing about embedding Coyote Graphics
>
> symbols in text changes that. Can you give me an example of
>
> what you are looking for?
>
>
>
> Cheers,
>
>
>
> David
>
>
>
>
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

Sorry, I was being a noob and found what you mentioned above soon after posting. I have forgetten those formatting codes and was actually thinking of something like the textoidl code by Matt Craig which being tex/latex is a bit more humanly readable.

But anyways, many thanks for this addition to your wonderful coyote graphics system.

Andy
Re: Greek and other Symbols in Coyote Graphics [message #81087 is a reply to message #80968] Wed, 08 August 2012 06:38 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
ameigs writes:

> Excellent David. Now how about subscripts and superscripts? Or is that already taken care of?

I'm not sure I understand what you are asking for. Subscripts
and superscripts can already be embedded into strings with the
normal formatting codes. Nothing about embedding Coyote Graphics
symbols in text changes that. Can you give me an example of
what you are looking for?

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Greek and other Symbols in Coyote Graphics [message #81104 is a reply to message #80968] Fri, 17 August 2012 05:35 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
rryan@stsci.edu writes:

> What about time derivatives, like with a dot? For example, can you do the analogous LaTeX command: $\dot{M}$ to be dM/dt but as an M with a small dot over it? I know this is historically a very tough thing...

Yes, you need to do typographic aerobatics to do something
like this. For me to include a symbol in cgSymbol, the symbol
has to be available as a glyph in some kind of a font that
IDL can access.

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Greek and other Symbols in Coyote Graphics [message #81106 is a reply to message #81080] Thu, 16 August 2012 20:31 Go to previous message
Russell Ryan is currently offline  Russell Ryan
Messages: 122
Registered: May 2012
Senior Member
On Thursday, August 9, 2012 12:34:59 PM UTC-4, ameigs wrote:
> On Wednesday, August 8, 2012 2:38:49 PM UTC+1, David Fanning wrote:
>
>> ameigs writes:
>
>>
>
>>
>
>>
>
>>> Excellent David. Now how about subscripts and superscripts? Or is that already taken care of?
>
>>
>
>>
>
>>
>
>> I'm not sure I understand what you are asking for. Subscripts
>
>>
>
>> and superscripts can already be embedded into strings with the
>
>>
>
>> normal formatting codes. Nothing about embedding Coyote Graphics
>
>>
>
>> symbols in text changes that. Can you give me an example of
>
>>
>
>> what you are looking for?
>
>>
>
>>
>
>>
>
>> Cheers,
>
>>
>
>>
>
>>
>
>> David
>
>>
>
>>
>
>>
>
>>
>
>>
>
>> --
>
>>
>
>> David Fanning, Ph.D.
>
>>
>
>> Fanning Software Consulting, Inc.
>
>>
>
>> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
>>
>
>> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>
>
>
> Sorry, I was being a noob and found what you mentioned above soon after posting. I have forgetten those formatting codes and was actually thinking of something like the textoidl code by Matt Craig which being tex/latex is a bit more humanly readable.
>
>
>
> But anyways, many thanks for this addition to your wonderful coyote graphics system.
>
>
>
> Andy

What about time derivatives, like with a dot? For example, can you do the analogous LaTeX command: $\dot{M}$ to be dM/dt but as an M with a small dot over it? I know this is historically a very tough thing...

Russell
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: tlb_frame_attr in Mac
Next Topic: Coyote Library Updates

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:35:47 PDT 2025

Total time taken to generate the page: 0.00649 seconds