IDL8.0 plot() function : how to plot to PS file like with DG "Set_Plot"? [message #72415] |
Wed, 15 September 2010 10:26  |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
Hello,
O.k., I finally got IDLv8.0 installed. I plotted the example in the docs:
IDL> t=SIN(2.0*FINDGEN(200)*!PI/25.0)*EXP(-0.02*FINDGEN(200))
IDL> p=plot(t,title="blah",xtitle='x',ytitle='y',color='red')
% Loaded DLM: XML.
O.k., great.
Now I want to plot it directly to a file (like I do with direct graphics after using SET_PLOT,'PS'). I guess the PRINT
method is the go... but how does one specify an output filename? Searching the documentation.... ah, o.k. the SAVE
method is what I need. Cool. I want to save a regular old, non-encapsulated, PostScript file
IDL> p.save,'test.ps'
Running that through ghostview tells me it's an encapsulated file. How to create a regular PS file? Is there no regular
PS support? The 800 pound gorilla in the iTools room was the lousy support for PS output... that silverback is still
hanging around I see. Argh.
On the plus side, finally I can easily add and modify legends. yay!
But, overall, for programmatic output into ps files, direct graphics still wins IMO.
cheers,
paulv
p.s. BTW, what's with the shorthand formatting e.g. "-r2+"? Is ITTVIS trying to make IDL look like matlab?!? :o)
|
|
|
Re: IDL8.0 plot() function : how to plot to PS file like with DG "Set_Plot"? [message #72511 is a reply to message #72415] |
Mon, 20 September 2010 16:06   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Chris Torrence writes:
> Well, hopefully we are lowering the "hurt factor" for graphics,
> especially for new users.
I agree you are heading in the right direction. :-)
> David, do you have a simple reproduce case that shows the legend
> leaking out of its box?
It was pretty simple code.
;**************************************************
x = FINDGEN(200)
y = FINDGEN(100)+5
plot0 = PLOT(x*COS(x/10), x*SIN(x/10), 'b', $
NAME='First Plot')
plot1 = PLOT(y*COS(y/5), y*SIN(y/5), 'r', $
NAME='Second Plot', /OVERPLOT)
leg = legend(target=[plot0, plot1], linestyle=0)
;leg = legend(target=[plot0, plot1], $
; horizontal_spacing=0.1, linestyle=0)
end
;*************************************************
I'm running this on Windows 64-bit OS. All I did was
create the plot and then I saved it as a PDF file.
I opened it with Adobe Acrobat 9, latest version.
The "Second Plot" is extending outside the legend
boundaries.
I put a picture here, if you want it:
http://www.dfanning.com/misc/idl.pdf
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.")
|
|
|
|
|
Re: IDL8.0 plot() function : how to plot to PS file like with DG "Set_Plot"? [message #72518 is a reply to message #72415] |
Mon, 20 September 2010 09:25   |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
David Fanning wrote:
> Chris Torrence writes:
>
>> Our assumption with the new graphics output was that people would use
>> EPS files for importing into other programs - LaTeX documents, MS
>> Word, Powerpoint, etc. And they would use PDF output for stand-alone
>> files, where you want just the graphics on a piece of paper.
>>
>> If there is a specific need for regular PS files, we would love to
>> hear about it, so we can consider adding support for this.
>
> To some extent, whether you need old technology depends upon
> whether the new technology works as well as or better than
> the old. If it doesn't work as well, people might be slow
> to adopt it.
And don't underestimate the time cost to switching. If it's easy to switch (e.g. change a paraticular call or keyword)
no worries. If it's not, then a lot of folks won't...until they absolutely have to. I use IDL to free up time so I can
worry about the minutiae of problems that actually interest me (you know, like, science-y stuff).
> Just this morning I was exploring PDF output, for example.
> I created a 3D plot (plot3d) with a legend (legend). All
> looks as it should on my display. But when I saved the
> file to a PDF file and opened that with Acrobat, the
> names in the legend extend outside the legend box.
> Pretty ugly.
Urg. That doesn't bode well. Sounds like there is a complete new set of fudge factors to learn to make plots appear wysiwyg.
> I presume this can be fixed (although I haven't
> yet discovered how), but it does make you wish for
> the old days when it happens to you first thing on
> a Monday morning. :-)
Ha ha! Maybe the lesson here is to never do any IDL graphics programming until Tuesday? :o)
After introspection over the weekend (riding over hills near the Catoctin mtns on a single speed tends to make one think
about anything other than the hurt factor) I'm convinced the NG approach is a good one - a much better one than straight
OG/iTools. ITTVIS still has some work to do to iron out some issues, but with the new NG interface the majority of the
work -- from a user perspective at least -- seems to be done.
cheers,
paulv
|
|
|
|
Re: IDL8.0 plot() function : how to plot to PS file like with DG "Set_Plot"? [message #72520 is a reply to message #72415] |
Mon, 20 September 2010 08:45   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Chris Torrence writes:
> Our assumption with the new graphics output was that people would use
> EPS files for importing into other programs - LaTeX documents, MS
> Word, Powerpoint, etc. And they would use PDF output for stand-alone
> files, where you want just the graphics on a piece of paper.
>
> If there is a specific need for regular PS files, we would love to
> hear about it, so we can consider adding support for this.
To some extent, whether you need old technology depends upon
whether the new technology works as well as or better than
the old. If it doesn't work as well, people might be slow
to adopt it.
Just this morning I was exploring PDF output, for example.
I created a 3D plot (plot3d) with a legend (legend). All
looks as it should on my display. But when I saved the
file to a PDF file and opened that with Acrobat, the
names in the legend extend outside the legend box.
Pretty ugly.
I presume this can be fixed (although I haven't
yet discovered how), but it does make you wish for
the old days when it happens to you first thing on
a Monday morning. :-)
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.")
|
|
|
Re: IDL8.0 plot() function : how to plot to PS file like with DG "Set_Plot"? [message #72535 is a reply to message #72415] |
Thu, 16 September 2010 15:03   |
R.G.Stockwell
Messages: 163 Registered: October 2004
|
Senior Member |
|
|
"Chris Torrence" <gorthmog@gmail.com> wrote in message
news:95f9a953-d985-403f-b329-73e091eba963@r10g2000vbc.google groups.com...
>> p.s. BTW, what's with the shorthand formatting e.g. "-r2+"? Is ITTVIS
>> trying to make IDL look like matlab?!? :o)
>
> Python! :o
>
>
>> But, overall, for programmatic output into ps files, direct graphics
>> still wins IMO.
>
>
> Just out of curiosity, would it be possible to use PDF files instead
> of PS (assuming that we add multi-page PDF support of course)?
>
> For the PDF support, we made sure that it is both lossless and outputs
> to vector format by default. So it should contain the same info as a
> PS file. You should also be able to import it into many graphics
> packages, if you need to do any additional tweaks. Finally, most
> standard Unix printer drivers (e.g. CUPS) can handle PDF files just
> fine.
>
> Our assumption with the new graphics output was that people would use
> EPS files for importing into other programs - LaTeX documents, MS
> Word, Powerpoint, etc. And they would use PDF output for stand-alone
> files, where you want just the graphics on a piece of paper.
>
> If there is a specific need for regular PS files, we would love to
> hear about it, so we can consider adding support for this.
>
> Thanks!
>
> -Chris
> ITTVIS
> p.s. NG = OG(DG)
Hi Chris,
my two cents on this. Many researchers use LaTeX, which has an option for
including ps (eps) files, XOR including pdf and image files. You can't mix
them.
And as I am sure you know, the research community changes its computer
practices
very slowly (usually you have to wait for everyone to die, then have a new
generation
come in using new tools. :)
So, that is one reason for many IDL users to stick to ps files. Even though
it almost
always ends up getting pdfed.
cheers,
bob
|
|
|
|
|
|
Re: IDL8.0 plot() function : how to plot to PS file like with DG "Set_Plot"? [message #72544 is a reply to message #72415] |
Thu, 16 September 2010 12:56   |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
Chris Torrence wrote:
>> p.s. BTW, what's with the shorthand formatting e.g. "-r2+"? Is ITTVIS trying to make IDL look like matlab?!? :o)
>
> Python! :o
Ah! :o)
>
>> But, overall, for programmatic output into ps files, direct graphics still wins IMO.
>
> Just out of curiosity, would it be possible to use PDF files instead
> of PS (assuming that we add multi-page PDF support of course)?
Maybe. But I would have to spend the time to find out. And I sure hope you add multi-page PDF support - I don't want to
have to email or ftp many many files when just one will do.
> For the PDF support, we made sure that it is both lossless and outputs
> to vector format by default. So it should contain the same info as a
> PS file. You should also be able to import it into many graphics
> packages, if you need to do any additional tweaks. Finally, most
> standard Unix printer drivers (e.g. CUPS) can handle PDF files just
> fine.
>
> Our assumption with the new graphics output was that people would use
> EPS files for importing into other programs - LaTeX documents, MS
> Word, Powerpoint, etc. And they would use PDF output for stand-alone
> files, where you want just the graphics on a piece of paper.
The problem with the above paragraph is the statement that begins: "Our assumption..." :o)
My "PS-dependence" that I've developed over the years is pretty much solely due to IDL. That is, that's all I could get
from it (using since '94). As such, much of my workflow revolves around using PS files. And, yes, that even involves
conversion of them to EPS and PDF. It's not uncommon for me to directly edit the PS files to, for example, increase the
scaling, or change the bounding box, or add elements.
I'm not against switching to EPS or PDF in principle, but to have that decision made for me before I have an opportunity
to determine how much work it will be for me to accommodate that change is what I object to - especially when we're
paying for the product.
> If there is a specific need for regular PS files, we would love to
> hear about it, so we can consider adding support for this.
Erm, I'm confused. IDL *already* has PS output support. It's just that you have to use DG to get at it. Why is there any
issue at all with extending this existing functionality to the NG system of routines?
Regardless, to avoid descent into the yawning pit of crotchety-old-bugger-dom before me, I will give the IDL PDF option
a try. But, please please please add multi-page PDF output support in v8.0.1 (or whatever).
cheers,
paulv
|
|
|
|
|
|
|
|
Re: IDL8.0 plot() function : how to plot to PS file like with DG "Set_Plot"? [message #72554 is a reply to message #72415] |
Thu, 16 September 2010 09:59   |
chris_torrence@NOSPAM
Messages: 528 Registered: March 2007
|
Senior Member |
|
|
> p.s. BTW, what's with the shorthand formatting e.g. "-r2+"? Is ITTVIS trying to make IDL look like matlab?!? :o)
Python! :o
> But, overall, for programmatic output into ps files, direct graphics still wins IMO.
Just out of curiosity, would it be possible to use PDF files instead
of PS (assuming that we add multi-page PDF support of course)?
For the PDF support, we made sure that it is both lossless and outputs
to vector format by default. So it should contain the same info as a
PS file. You should also be able to import it into many graphics
packages, if you need to do any additional tweaks. Finally, most
standard Unix printer drivers (e.g. CUPS) can handle PDF files just
fine.
Our assumption with the new graphics output was that people would use
EPS files for importing into other programs - LaTeX documents, MS
Word, Powerpoint, etc. And they would use PDF output for stand-alone
files, where you want just the graphics on a piece of paper.
If there is a specific need for regular PS files, we would love to
hear about it, so we can consider adding support for this.
Thanks!
-Chris
ITTVIS
p.s. NG = OG(DG)
|
|
|
|
Re: IDL8.0 plot() function : how to plot to PS file like with DG "Set_Plot"? [message #72557 is a reply to message #72415] |
Thu, 16 September 2010 07:38   |
Kenneth P. Bowman
Messages: 585 Registered: May 2000
|
Senior Member |
|
|
In article <i6qvje$fa4$1@speranza.aioe.org>,
Paul van Delst <paul.vandelst@noaa.gov> wrote:
> IDL> p.save,'test.ps'
>
> Running that through ghostview tells me it's an encapsulated file.
> How to create a regular PS file?
According to the documentation, using a file suffix of either .eps or
.ps produces EPS output.
I suspect this is part and parcel of the current inability to produce
multi-page graphics files. This is a significant limitation to New
Graphics (NG), and an important thing to be aware of before converting
Direct Graphics (DG) programs to NG.
In an earlier thread Chris Torrence from ITTVIS said:
> For the new graphics, we added support for PDF output, but we ran out
> of time to do multi-page output. I have some prototype code that adds
> this feature, if you're interested in trying it out.
>
> Cheers,
> Chris
> ITTVIS
I think multi-page implies PS, rather than EPS.
I think New Graphics is very cool and potentially much easier to use
than direct graphics. I look forward to not having to try to explain
DG devices and the differences between them to my students.
Ken Bowman
P.S. A formal proposal
DG = Direct Graphics
NG = New Graphics
OG = Object Graphics
|
|
|
Re: IDL8.0 plot() function : how to plot to PS file like with DG "Set_Plot"? [message #72623 is a reply to message #72511] |
Wed, 22 September 2010 11:13  |
Matt Haffner
Messages: 34 Registered: October 2000
|
Member |
|
|
I have the same issue on OS X: all my text and plot symbols are
slightly scaled up when saving a NG to PDF (compared to the display).
However, if I print and "Save to PDF..." in the standard OS X print
dialog box, I get a PDF with no scaling; the layout matches my screen
display.
mh
On Sep 20, 6:06 pm, David Fanning <n...@dfanning.com> wrote:
> Chris Torrence writes:
>> Well, hopefully we are lowering the "hurt factor" for graphics,
>> especially for new users.
>
> I agree you are heading in the right direction. :-)
>
>> David, do you have a simple reproduce case that shows the legend
>> leaking out of its box?
>
> It was pretty simple code.
>
> ;**************************************************
> x = FINDGEN(200)
> y = FINDGEN(100)+5
> plot0 =PLOT(x*COS(x/10), x*SIN(x/10), 'b', $
> NAME='FirstPlot')
> plot1 =PLOT(y*COS(y/5), y*SIN(y/5), 'r', $
> NAME='SecondPlot', /OVERPLOT)
> leg = legend(target=[plot0, plot1], linestyle=0)
> ;leg = legend(target=[plot0, plot1], $
> ; horizontal_spacing=0.1, linestyle=0)
> end
> ;*************************************************
>
> I'm running this on Windows 64-bit OS. All I did was
> create theplotand then I saved it as a PDF file.
> I opened it with Adobe Acrobat 9, latest version.
> The "SecondPlot" is extending outside the legendboundaries.
>
> I put a picture here, if you want it:
>
> http://www.dfanning.com/misc/idl.pdf
>
> 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.")
|
|
|