Re: Coyote Library Updates [message #77067 is a reply to message #62777] |
Tue, 02 August 2011 06:59   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
> cgWINDOW -- One of the limitations of the way cgWindow
> stores commands is that keyword values are evaluated
> at the time the graphics command is added to the window.
> This precludes the use of expressions as keywords and prevents
> you from doing things like using a different line thickness
> in a PostScript file, or using the Greek function to
> supply a Greek symbol for a graphics title.
>
> I have come up with a method for working around this limitation.
> It involves a new keyword to the cgWindow command, named WKYEXPR.
> With this keyword you list the command keywords that should be
> "evaluated" at run-time. The actual keyword value will need to
> be a string that can be "evaluated" with the IDL Execute command
> to produce a "real" keyword value at the time the command is
> executed. This allows you to set different values for the window
> display and for the PostScript display, for example. The WKYEXPR
> keyword can be used with any CGS routine that supports the current
> WINDOW keyword.
>
> Here is how you might use it, for example, with the cgPlot command.
>
> cgPlot, cgDemoData(1), WKWEXPR=['TITLE', 'THICK'], /WINDOW, $
> TITLE='"Greek Psi Symbol (" + Greek("psi") + ")"', $
> THICK='(!D.Name EQ "PS") ? 3.5 : 1.0', $
> CHARSIZE=1.5, COLOR='NAVY'
>
> I've written an article to explain this in more detail:
>
> http://www.idlcoyote.com/cg_tips/kwexpressions.php
>
> The updated program is here:
>
> http://www.idlcoyote.com/programs/cgwindow.pro
Yikes! I somehow copied the wrong program into the distribution!
Not sure how that happened.
Then, when I finally got the right program installed,
I had a programming error that IDL 8.1 allowed to slide,
but IDL 7.1 didn't. And, worse, IDL 7.1 was leaking
memory that IDL 8.1 was cleaning up!!
I guess I appreciate that IDL 8.1 allows sloppier
programming, but I'm struggling with the implications. :-(
Anyway, fixed now, I think. Sorry for the confusion.
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.")
|
|
|