Function Graphics Questions [message #87179] |
Tue, 14 January 2014 09:56  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Folks,
I have a New Year's resolution to learn more about function graphics
this year. I thought I would start with this multiple axis plot Chris
and Matt have been talking about this week. My idea was to produce
mirror of the Coyote Gallery plots, as much as I can.
I guess I've spent about three hours on this now and finally have this
one program in shape to be able to compare Coyote Graphics output with
the equivalent function graphics output. In doing so, I've run into some
questions. Perhaps someone knows the answers.
Question 1: I have no particular objection to the PostScript output
produced by function graphics commands, but is it true there is no
program control over things like the thickness of the PostScript lines?
Question 2: As far as I can tell, saving the contents of a function
graphics window as a PostScript file *always* creates encapsulated
PostScript files. Since encapsulated Postscript files (AFAIK) always
have to be in portrait mode, what is the purpose of the LANDSCAPE
keyword to the window save command?
In other words, this command:
window.save, 'test.ps', /Landscape
Produces exactly the same output, as far as I can tell, as this command:
window.save, 'test.ps'
Question 3: I haven't upgraded to IDL 8.3. Can someone tell me if the
bug in IDL 8.2.3 that prevents any line style except solid in PostScript
output is fixed. In other words, do these commands produce a Postscript
plot with a dashed line:
p = Plot(/test, LineStyle=2)
p.save, 'test.ps'
Question 4: Am I missing something obvious here. I mostly produce JPEG,
PNG, and TIFF output either for my web page of for e-mailing
intermediate results to colleagues. I like them to be reasonably small.
For my web page, for example, I like them to be no more than 600 pixels
wide. My usual way of creating such raster output is to run my code like
this:
cgPS_Open, 'test.png'
cgPlot, cgDemoData(1)
cgPS_Close, Width=600
The equivalent in function graphics is something like this:
p = Plot(cgDemoData(1))
p.save, 'test.png', width=600
But, this kind of output is very low resolution compared to what I've
come to expect.
I find the only way I can get high quality PNG files is to produce them
at full resolution, then resize them in the software I use for dealing
with raster images (Photoshop, Hypersnap, etc.). Since I have
ImageMagick hanging around, I find I can get what I want in IDL by doing
something like this:
p = Plot(cgDemoData(1))
p.save, 'test.png'
Spawn, 'convert test.png -resize 600 test_resized.png'
Is there a better way to do this?
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.")
|
|
|
Re: Function Graphics Questions [message #87181 is a reply to message #87179] |
Tue, 14 January 2014 13:23   |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
On 01/14/14 12:56, David Fanning wrote:
> Folks,
>
> I have a New Year's resolution to learn more about function graphics
> this year. I thought I would start with this multiple axis plot Chris
> and Matt have been talking about this week. My idea was to produce
> mirror of the Coyote Gallery plots, as much as I can.
>
> I guess I've spent about three hours on this now and finally have this
> one program in shape to be able to compare Coyote Graphics output with
> the equivalent function graphics output. In doing so, I've run into some
> questions. Perhaps someone knows the answers.
>
> Question 1: I have no particular objection to the PostScript output
> produced by function graphics commands, but is it true there is no
> program control over things like the thickness of the PostScript lines?
?
You mean you don't see any difference when you use the THICK keyword?
I see a difference in the line thickness between ps output when I do:
p = Plot(/test, LineStyle=2)
p.save, 'test.ps'
and
p = Plot(/test, LineStyle=2,thick=2)
p.save, 'test.ps'
> Question 2: As far as I can tell, saving the contents of a function
> graphics window as a PostScript file *always* creates encapsulated
> PostScript files. Since encapsulated Postscript files (AFAIK) always
> have to be in portrait mode, what is the purpose of the LANDSCAPE
> keyword to the window save command?
>
> In other words, this command:
>
> window.save, 'test.ps', /Landscape
>
> Produces exactly the same output, as far as I can tell, as this command:
>
> window.save, 'test.ps'
Dunno. I always create png output or eps for including in documents so I
don't use /landscape.
> Question 3: I haven't upgraded to IDL 8.3. Can someone tell me if the
> bug in IDL 8.2.3 that prevents any line style except solid in PostScript
> output is fixed. In other words, do these commands produce a Postscript
> plot with a dashed line:
>
> p = Plot(/test, LineStyle=2)
> p.save, 'test.ps'
IDL v8.3 produces a dashed line in the ps output.
> Question 4: Am I missing something obvious here. I mostly produce JPEG,
> PNG, and TIFF output either for my web page of for e-mailing
> intermediate results to colleagues. I like them to be reasonably small.
> For my web page, for example, I like them to be no more than 600 pixels
> wide. My usual way of creating such raster output is to run my code like
> this:
>
> cgPS_Open, 'test.png'
> cgPlot, cgDemoData(1)
> cgPS_Close, Width=600
>
> The equivalent in function graphics is something like this:
>
> p = Plot(cgDemoData(1))
> p.save, 'test.png', width=600
>
> But, this kind of output is very low resolution compared to what I've
> come to expect.
I don't know if it's the same thing (you're windows, right?), but I was
experiencing a problem with v8.2.2/3 on a RHEL6 system where the png
output of a plot had very blocky/pixel-y lines. Exelis help replicated
the problem on their CentOS systems even with v8.3. The following
workaround provided by Exelis made the lines smooth again:
$ export IDL_DISABLE_STROKED_LINES=1
The issue has been reported as IDL-69024.
cheers,
paulv
>
> I find the only way I can get high quality PNG files is to produce them
> at full resolution, then resize them in the software I use for dealing
> with raster images (Photoshop, Hypersnap, etc.). Since I have
> ImageMagick hanging around, I find I can get what I want in IDL by doing
> something like this:
>
> p = Plot(cgDemoData(1))
> p.save, 'test.png'
> Spawn, 'convert test.png -resize 600 test_resized.png'
>
> Is there a better way to do this?
>
> Cheers,
>
> David
>
|
|
|
Re: Function Graphics Questions [message #87183 is a reply to message #87181] |
Tue, 14 January 2014 13:36   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Paul van Delst writes:
> You mean you don't see any difference when you use the THICK keyword?
>
> I see a difference in the line thickness between ps output when I do:
>
> p = Plot(/test, LineStyle=2)
> p.save, 'test.ps'
>
> and
>
> p = Plot(/test, LineStyle=2,thick=2)
> p.save, 'test.ps'
No, I see a difference using the thick keyword. But, I am used to
writing code like this to make a line proportionately as thick in the
PostScript device.
thick = (!D.Name EQ 'PS') ? 6 : 2
The difference between PostScript "thickness" and display "thickness"
appears to be taken care of automatically, so that a line that is twice
as thick on the display is proportionately twice as thick in PostScript.
But, as far as I can tell, there is no way to do something like this:
thick = (!D.Name EQ 'PS') ? 10 : 2
And make the line *extra* thick in PostScript.
I actually like the way this works, but I just wanted to be sure there
was no programmable way to control it.
With regard to pixelated PNG files, this sounds about right. I don't
know how to apply the "fix" to my Windows machine, though. :-(
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.")
|
|
|
|
|
|
|
|
|
Re: Function Graphics Questions [message #87231 is a reply to message #87218] |
Fri, 17 January 2014 07:32   |
chris_torrence@NOSPAM
Messages: 528 Registered: March 2007
|
Senior Member |
|
|
On Thursday, January 16, 2014 11:45:20 AM UTC-7, David Fanning wrote:
> Paul van Delst writes:
>
>
>
>> I'm curious - is it just the line plots that are low res? Are all the
>
>> accompanying graphics (axis text) shown in high res (i.e. not blocky)?
>
>>
>
>> I only had issues with the lines in my plots. All the other plot
>
>> accoutrements were fine.
>
>
>
> Yeah, I guess it's just the lines. The plot I was working with had three
>
> lines on it. All very low resolution. The plot annotations look OK.
>
>
>
> 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.")
Hi David,
Can you post your plot with the bad lines somewhere, or email it to me?
Thanks!
-Chris
|
|
|
|
Re: Function Graphics Questions [message #87233 is a reply to message #87232] |
Fri, 17 January 2014 13:14   |
chris_torrence@NOSPAM
Messages: 528 Registered: March 2007
|
Senior Member |
|
|
On Friday, January 17, 2014 9:53:56 AM UTC-7, David Fanning wrote:
> Chris Torrence writes:
>
>
>
>> Can you post your plot with the bad lines somewhere, or email it to me?
>
>
>
> Hi Chris,
>
>
>
> Out of town at the moment and my e-mail is causing me problems. But, you
>
> can get the code that produces the image in question here:
>
>
>
> http://www.idlcoyote.com/gallery/additional_axes_plot_fg.pro
>
>
>
> The image it produces is called additional_axes_plot_fg.png.
>
>
>
> 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 thos speakest truth.")
Okay, I got it all to run. You're right, it looks pretty chunky at 600 pixels. I had toyed around with adding "anti-aliasing" to the output, but I never finished the code. I'll dig it up and see if I can get it into the next release.
It would basically do the same thing - construct the output at a high resolution, then scale it down to the desired resolution and output the result. The advantage would be that it wouldn't need to write out an intermediate file or rely on imagemagick.
-Chris
|
|
|
Re: Function Graphics Questions [message #87617 is a reply to message #87233] |
Tue, 18 February 2014 13:37  |
chris_torrence@NOSPAM
Messages: 528 Registered: March 2007
|
Senior Member |
|
|
Hi all,
I just added antialias support to the new graphics ::Save method. By default, for bitmap file formats, if your resolution is less than 300dpi, then it will use anti-aliasing to produce a smooth output result. You can use a new ANTIALIAS keyword to control the behavior.
If anyone want to try out the code, let me know.
Cheers,
Chris
|
|
|