Re: cgimage not generating output with cgps_open and cgps_close (fine in X window) . [message #89478 is a reply to message #89475] |
Mon, 20 October 2014 12:54   |
JTMHD
Messages: 9 Registered: October 2014
|
Junior Member |
|
|
On Monday, 20 October 2014 19:14:50 UTC+1, David Fanning wrote:
> David Fanning writes:
>
>
>
>>
>
>> David Fanning writes:
>
>>
>
>>> Well, leave the XSCALE and YSCALE keywords off your cgImage command.
>
>>> They aren't needed (cgImage does this automatically), and they are
>
>>> somehow (don't understand it yet) screwing things up.
>
>>
>
>> Alright, here is what is happening. This is a combination of the usual
>
>> keyword inheritance nonsense, with a little twist from IDL letting you
>
>> abbreviate keyword names.
>
>>
>
>> The proper way to set axis properties in cgImage is via the AXKeywords
>
>> keyword, which no one can figure out how to use. So I allow a *limited*
>
>> number of axis keywords to be used on the cgImage command line (e.g.,
>
>> xrange and yrange). I don't forbid you to use XSCALE and YSCALE keywords
>
>> (the ol' keyword inheritance problem), but there should be no reason to
>
>> use them, either. cgImage knows what it is doing and does axis things
>
>> correctly.
>
>>
>
>> Had you actually used XSCALE and YSCALE keywords, instead of their
>
>> shorted form XS and YS, you would have received an error message, since
>
>> these keywords are passed along to the TV command. They don't mean
>
>> anything to the TV command, so the TV command complains. But, in their
>
>> shortened form, XS and YS, they are interpreted by the TV command as the
>
>> XSIZE and YSIZE keywords, and they will overwrite the XSIZE and YSIZE
>
>> values cgImage uses internally to size a PostScript image. (The XSIZE
>
>> and YSIZE keywords are only used by the TV command when in the
>
>> PostScript device.) As a result, and this is why you weren't getting an
>
>> error, your image was being sized to a one-by-one pixel, which was being
>
>> displayed correctly in your output. :-)
>
>
>
> By the way, when you write code like this:
>
>
>
> cgimage, image, /xs, /ys
>
>
>
> You are doing two things wrong in my opinion. You are abbreviating
>
> keyword names, which makes your programs difficult to understand and
>
> debug (see current discussion today), and you are using a keyword
>
> shortcut that is inappropriate with non-boolean keywords that can have
>
> values *other* than 0 or 1. It works, but it strikes me as a lousy
>
> programming practice, since it, too, sends the wrong message to people
>
> looking for problems in your programs.
>
>
>
> Cheers,
>
>
>
> David
>
>
>
>
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")
I see what you are saying and will bear it in mind. Its a hangover from using IDL interactively for a quick look at data, but I can totally see how this good practice would pay off if you where writing more sophisticated tools
|
|
|