Re: Why plots shown on screen and postscript are different? [message #65081] |
Wed, 11 February 2009 06:44  |
liamgumley
Messages: 74 Registered: June 2005
|
Member |
|
|
On Feb 11, 12:07 am, xqinshan <xqins...@tom.com> wrote:
> Generally, I do my work using 'set_plot,'win'' first, showing the
> plots on screen. Then after everything is good, I simply change it to
> 'set_plot,'ps'', sometimes the plots in postscript is good as what I
> saw on screen, but sometimes so bad for I have to change settings
> again and again. May I ask how to do this? In fact, I need plots in
> postscript only for publication or presentation. Are there any method
> to save the plots on screen for that? I mean, sometimes I need high
> quality plots, but saveJpeg donot save good enough plots.
To create a PostScript plot which matches your onscreen plot, try
this.
1. Download the sample programs from "Practical IDL Programming"
http://gumley.com/PIP/Sample_Programs/PIP_programs.zip
2. Create your plot onscreen in a direct graphics window, e.g.
IDL> window, /free
IDL> plot, sin(!pi * 0.1 * findgen(100)), title='My First Plot'
3. Recreate the plot with output directed to PostScript using PSON and
PSOFF, e.g.,
IDL> pson, file='test.ps'
IDL> plot, sin(!pi * 0.1 * findgen(100)), title='My First Plot'
IDL> psoff
You will find that test.ps contains an exact replica of your onscreen
plot. You can also try variations like this:
IDL> pson, file='test.ps', paper='A4', /landscape
IDL> device, /helvetica
IDL> plot, sin(!pi * 0.1 * findgen(100)), title='My First Plot',
font=0
IDL> psoff
This will recreate the plot in landscape orientation on A4 size paper
using the PostScript Helvetica font.
Cheers,
Liam.
Practical IDL Programming
http://www.gumley.com/
|
|
|
|
Re: Why plots shown on screen and postscript are different? [message #65083 is a reply to message #65082] |
Wed, 11 February 2009 06:31   |
Maarten[1]
Messages: 176 Registered: November 2005
|
Senior Member |
|
|
On Feb 11, 3:02 pm, David Fanning <n...@dfanning.com> wrote:
> T.H. writes:
>> I've found that most of the time postscript plotting is more trouble
>> than it's worth. If I have a plot on screen that I wish to keep I
>> usually save it as PNG using a command something like.......
>
>> WRITE_PNG, filename, TVRD()
>
> Humm, well, we all have our own standards, I guess. :-)
>
> This notion of how to write a program that looks good
> on the display and in a PostScript file comes up over
> and over. It really is quite simple to do, and the clues
> are all over my web page, although oddly they have never
> been collected in a single article.
I take a different approach: I (almost) never plot on screen. All my
plotting is done to Postscript, and I view the result with a
spawn, "gv " + plotfilename + " &"
The only exception is when I need to look at the contents of an array
during debugging. But you rarely want to publish those ;-)
Maarten
|
|
|
Re: Why plots shown on screen and postscript are different? [message #65086 is a reply to message #65083] |
Wed, 11 February 2009 06:02   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
T.H. writes:
> I've found that most of the time postscript plotting is more trouble
> than it's worth. If I have a plot on screen that I wish to keep I
> usually save it as PNG using a command something like.......
>
> WRITE_PNG, filename, TVRD()
Humm, well, we all have our own standards, I guess. :-)
This notion of how to write a program that looks good
on the display and in a PostScript file comes up over
and over. It really is quite simple to do, and the clues
are all over my web page, although oddly they have never
been collected in a single article. I should do that if
I ever get a break from my stats homework. :-(
The basics are quite simple. Protect non-PostScript
commands in your program. What are "non-PostScript
commands"? There are only a handful:
Erase
WSet
Window
Device, Decomposed=1
You "protect" them like this (demonstrated with the
Window command):
IF (!D.Flags AND 256) NE 0 THEN Window
Next, you take care that you use a minimum number of
system variables to affect your plots, etc. Rather, use keywords
on the Plot commands themselves whenever possible.
Then, you have to set the PostScript device up appropriately.
I always use PSConfig for this. You can use PSConfig with a
graphical user interface or not. It is up to you.
And, finally, you typically have to choose a hardcopy or
true-type font. I typically use true-type fonts.
I accomplish setting up the PostScript device, getting my
fonts correct, etc. with PS_START. This will also make
the PostScript output have the same aspect ratio as your
current graphics window (a property of PSConfig), so what
you get in PostScript looks very much like what you see
on your display. I close everything up with PS_END.
PS_END has the added ability to make JPEG, PNG, and TIFF
file output from the PostScript output, using ImageMagick,
which creates image output with very nice looking fonts,
suitable for viewing in presentations, on a web page, etc.
All of the programs I mentioned are part of the Coyote
Library:
http://www.dfanning.com/documents/programs.html
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: Why plots shown on screen and postscript are different? [message #65090 is a reply to message #65086] |
Wed, 11 February 2009 03:36   |
T.H.
Messages: 13 Registered: December 2008
|
Junior Member |
|
|
On Feb 11, 1:07 am, xqinshan <xqins...@tom.com> wrote:
> Hi,
>
> Generally, I do my work using 'set_plot,'win'' first, showing the
> plots on screen. Then after everything is good, I simply change it to
> 'set_plot,'ps'', sometimes the plots in postscript is good as what I
> saw on screen, but sometimes so bad for I have to change settings
> again and again. May I ask how to do this? In fact, I need plots in
> postscript only for publication or presentation. Are there any method
> to save the plots on screen for that? I mean, sometimes I need high
> quality plots, but saveJpeg donot save good enough plots.
>
> Best,
>
> Xqinshan
I've found that most of the time postscript plotting is more trouble
than it's worth. If I have a plot on screen that I wish to keep I
usually save it as PNG using a command something like.......
WRITE_PNG, filename, TVRD()
|
|
|
Re: Why plots shown on screen and postscript are different? [message #65095 is a reply to message #65090] |
Tue, 10 February 2009 23:48   |
maurya
Messages: 16 Registered: February 2009
|
Junior Member |
|
|
On 11 Feb, 11:07, xqinshan <xqins...@tom.com> wrote:
> Hi,
>
> Generally, I do my work using 'set_plot,'win'' first, showing the
> plots on screen. Then after everything is good, I simply change it to
> 'set_plot,'ps'', sometimes the plots in postscript is good as what I
> saw on screen, but sometimes so bad for I have to change settings
> again and again. May I ask how to do this? In fact, I need plots in
> postscript only for publication or presentation. Are there any method
> to save the plots on screen for that? I mean, sometimes I need high
> quality plots, but saveJpeg donot save good enough plots.
>
> Best,
>
> Xqinshan
Really, If you are changing the device for plotting, the output will
be different. To get a good plot in ps you should define the device
properties manually. e.g.,
set_plot,'ps'
device,/inches,xsize=?,ysize=?,.........................
device=filename,/color,bits=32,..............
plot----------
device,/close
set_plot,'win'
For detail, please read "device" keyword.
I hope your plot will be nice.
|
|
|
Re: Why plots shown on screen and postscript are different? [message #65161 is a reply to message #65082] |
Thu, 12 February 2009 01:13  |
Maarten[1]
Messages: 176 Registered: November 2005
|
Senior Member |
|
|
On Feb 11, 3:37 pm, David Fanning <n...@dfanning.com> wrote:
> Maarten writes:
>> I take a different approach: I (almost) never plot on screen. All my
>> plotting is done to Postscript, and I view the result with a
>
>> spawn, "gv " + plotfilename + " &"
>
> I've seen this approach where GhostView is used as the
> display device. It always causes me to stare in
> complete and utter disbelief. I've always wanted
> to have a drink with one of these people to see how
> they think.
Advantages:
- One set of commands, with a single set of surprises.
- On screen display was pretty useless to begin with, IMHO.
Background info:
- I've been an Igor Pro user for years. Perhaps I'm indeed spoiled.
On the drinks bit: perhaps on your next trip to Europe?
> Are you a Republican, too? ;-)
Now, wait a minute!
Maarten - Happy Darwin day - Sneep
|
|
|