Re: How to Get Started with the Z-Buffer [message #51956 is a reply to message #51955] |
Tue, 19 December 2006 10:31  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Ryan. writes:
> I have a routine that plots about 15 plots and saves it to a postscript
> file. I want to automate this routine and put it into the cron but
> because I can't use graphics windows there I'm trying to modify my code
> to use the Z-buffer. I've read that all you have to do is set the
> Z-buffer (using SET_PLOT, 'Z') and plot normally. After plotting all
> my graphs, I read the image (a = TVRD()), set the PS device (SET_PLOT,
> 'PS'), and display the image (TV, a), but all I get is a large black
> box in the output. Is there anything I am missing? The IDL help on
> the Z-buffer is not very insightful on what it could be.
Well, it strikes me that just about everything about
this approach is wrong. But I don't want to discourage
you any. :-)
For starters, why are you fooling around with the Z-buffer
at all? Just write the darn thing into a PostScript file
to begin with. You can certainly do this with a cron job
and by doing this you have the ENORMOUS advantage of being
able to use PostScript resolution and not some rinky-dink
buffer or screen resolution. Your journal editor will smile
with you.
I think the basic reason you are seeing a big black window
is that either you are (1) drawing black on black (a result
of changing color indices 0 and 255, which is almost always
a BAD idea if you are going to try to create a PostScript
file, or (2) seeing only a portion of your "image" because
of a huge mismatch between the aspect ratio of your Z-buffer
and PostScript window. I can't tell which is the case, but
I don't have much motivation to find out, since both problems
would be eliminated by the simpler PostScript approach, which
I HIGHLY recommend.
I would do something like this:
keywords = PSConfig(Cancel=cancelled, XSize=10.25, YSize=8, $
/Inches, XOffset=0.25, YOffset=10.75, /Color, Bits=8, $
Filename='myfile.ps', /NoGUI, /Landscape)
thisDevice = !D.Name
Set_Plot, 'PS'
Device, _Extra=keywords
!P.Multi = [0,1,nsteps]
FOR j=0, nsteps-1 DO
Plot, data, ....
ENDFOR
Device, /Close_File
Set_Plot, thisDevice
!P.Multi = 0
There are a number of articles on my web page explaining the
various finer points of PostScript output, but I think the simpler
you can make it the better.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|