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

Home » Public Forums » archive » Re: More cgplot, ps_start, ps_end problems
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: More cgplot, ps_start, ps_end problems [message #75253 is a reply to message #75252] Sat, 19 February 2011 10:03 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Gray writes:

> Weird... I just used PS_START and PS_END to create .eps files... but
> ImageMagick can't find the .eps files to convert to PNGs when I have
> PS_END, /PNG set. Here's the output from PS_END:
>
> PostScript output will be created here: ~/Desktop/BrGamma_known.eps
> ImageMagick CONVRT command:
> convert -alpha off -density 300 "~/Desktop/BrGamma_known.eps" -resize
> 25% -flatten -rotate 90 "PNG24:~/Desktop/BrGamma_known.png"
> convert: unable to open image `~/Desktop/BrGamma_known.eps': No such
> file or directory @ error/blob.c/OpenBlob/2584
> convert: missing an image filename `PNG:~/Desktop/BrGamma_known.png' @
> error/convert.c/ConvertImageCommand/2949
>
> I get the .eps file on the desktop, and the image size is correct, but
> the plot isn't centered, it runs off the end, and the rotation is
> wrong.
>
> My last CG update is from a couple of days ago. Here's the routine
> that produces the plots:
>
> PRO knownplot, filt, nb, res, id, typ
> ps_start, file='~/Desktop/'+filt+'_known.eps',$
> /encapsulate,/inches,xsize=10,ysize=10
> cgplot, nb, res-nb, psym=1, xtitle=filt+' NB mag',$
> ytitle=filt+' Diff mag - NB mag',title+'Known WRs in '+$
> filt, charsize=1.25
> cgtext, nb, res-nb, typ, charsize=0.7, charthick=2, /data
> ps_end, /png
> end

OK, let me try this again.

The purpose of PS_Start is to allow you to create PostScript
output that matches the output you see in a display window.
So, by default it looks at the current graphics window,
determines that window's aspect ratio (or uses the default
aspect ratio, if a graphics window isn't open), and then
creates a window with that aspect ratio, centered, on
a PostScript "page". If the graphics window is wider than
it is tall, the PostScript "page" is assumed to be in
landscape mode. Otherwise, it assumes the page is in
portrait mode.

Now, you don't *have* to use PS_Start in default mode.
You can choose to override this default behavior. If you
do, you MUST set the NOMATCH keyword, so it does not
match the aspect ratio of the current graphics window.
And, if you choose to override this default behavior, I
presume (maybe you are reading my new book!) you know
something about how the PostScript device works. In other
words, you know how to set sizes and offsets that get your
PostScript "window" somewhere where you will actually be
able to see it when you "print" the PostScript page.
(Presumably this is the point of making a PostScript file.)

If you don't know much about how the PostScript device works,
then I recommend you set the GUI keyword on PS_Start and
use PSConfig to set up your PostScript page. If you did that
in this case, you would see pretty clearly that a 10 inch
by 10 inch square does NOT fit on an 8.5 by 11 inch PostScript
page with the default offsets! In other words, you would
would have to select some other page size to fit the size
of the window you want to create.

So, if fooled around long enough with PSConfig to get what
you wanted, then PS_End would know *exactly* what it is you
are trying to do, know that what you chose was "legal" in the
sense that something sensible could result from it, and I have
great confidence that the PNG file made from such a sensible
PostScript file would also look pretty darn good. :-)

Something like this would work:

ps_start, file='~/Desktop/'+filt+'_known.eps', $
/encapsulate,/inches,xsize=10,ysize=10, $
pagetype='ledger', xoffset=0.5, yoffset=13.5, $
/landscape, /gui

Well, actually, it appears ImageMagick is struggling a bit
with encapsulated PostScript files. I'll have to look into
this some more. I've never tried to turn encapsulated
PostScript files into raster files, so I don't know what
that problem might be.

While I am investigating, I think I'll add more error
handling to PSConfig to warn users that what they are
trying to do is not likely to work. :-)

I'll get back to you about ImageMagick and conversion
of encapsulated PostScript files.

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.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Music production, Anyone?!
Next Topic: Re: ncdf + x-connection + many files = crazy.

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

Current Time: Wed Oct 08 19:19:44 PDT 2025

Total time taken to generate the page: 0.00461 seconds