Font size appearance in function graphics PNG and EPS output [message #86825] |
Thu, 05 December 2013 11:49  |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
Hello,
I use function graphics to generate both PNG and EPS output of various
plots. When I create a PNG output like so:
IDL> p.Save, 'myplot.png', HEIGHT=500
the resulting image looks just like the onscreen plot. However, when I
create an EPS file, if I simply do something like
IDL> p.Save, 'myplot.eps'
the size of the fonts (in relation to the rest of the plot) appears to
decrease. As such, to make the text readable in EPS form I find myself
doing silly things like the following:
IDL> font_size = p.font_size
IDL> p.font_size = p.font_size * 2.0
IDL> p.Save, 'myplot.eps'
IDL> p.font_size = font_size
That is, I temporarily increase the size of the font so that they are a
useful size in the final EPS file.
The above example is an annoyance, but in some more complicated plots I
have code like the following:
; ...Output an EPS file
; ......Increase the font size for EPS files
font_size = HASH()
FOR band = 1, n_bands DO BEGIN
osrf[0].Get_Property, band, pRef=p, Debug=debug
font_size[band] = p.font_size
p.font_size = p.font_size * 2.0
ENDFOR
; ......Create the EPS file
w.Save, fileroot+'.eps'
; ......Restore the onscreen font sizes
FOR band = 1, n_bands DO BEGIN
osrf[0].Get_Property, band, pRef=p, Debug=debug
p.font_size = font_size[band]
ENDFOR
I've reached the straw/camel point and am asking this newsgroup if they
know what I'm doing wrong to get this weird font-sizing action in the
first place? Or is the IDL Postscript output just plain busted?
I created two files like so:
IDL> p.save,'test.png',height=500
IDL> p.save,'test.eps'
and have placed them here:
http://ftp.emc.ncep.noaa.gov/jcsda/CRTM/.plots
If you size the EPS file the same as the PNG image you will see the
fonts are proportionally much smaller.
Thanks for any insights.
cheers,
paulv
p.s. In case you were wondering, the EPS files are for documents to
allow people to view the plots in an e-document and retain the ability
to zoom in and view detail (which you don't get with images like PNG).
|
|
|
|
|
Re: Font size appearance in function graphics PNG and EPS output [message #86865 is a reply to message #86845] |
Mon, 09 December 2013 06:16   |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
I ran this:
PRO test_plot
x = DINDGEN(100)
y = (x/10.0d0)^2
p = PLOT(x,y, $
XTITLE='X axis title', $
YTITLE='Y axis title', $
TITLE ='Test plot title', $
FONT_SIZE=10)
p.save, 'test.png', HEIGHT=500
p.save, 'test.eps'
END
to generate the two files available at:
http://ftp.emc.ncep.noaa.gov/jcsda/CRTM/.plots
If this is fixed in v8.3, that would be good to know. Upgrading software
involves some signage away of offspring, so any supporting info helps.
:o) (just kidding...mostly)
cheers,
paulv
On 12/06/13 18:27, Chris Torrence wrote:
> On Friday, December 6, 2013 1:54:26 PM UTC-7, Gordon Farquharson
> wrote:
>> Hi Paul
>>
>>
>>
>> I'm surprised nobody has replied to your message yet. I have the
>> same problem, and I'd really like to know why as well.
>>
>>
>>
>> Chris, can you comment on this?
>>
>>
>>
>> Gordon
>
> Hi Paul & Gordon,
>
> I do know that there were some problems with font sizes in IDL 8.2
> and earlier. We fixed several issues for IDL 8.3.
>
> Do either of you have a simple reproduce case that shows the problem?
> That way I can try it out and let you know...
>
> Thanks!
>
> -Chris ExelisVIS
>
|
|
|
Re: Font size appearance in function graphics PNG and EPS output [message #86866 is a reply to message #86865] |
Mon, 09 December 2013 06:24   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Paul van Delst writes:
>
> I ran this:
>
> PRO test_plot
> x = DINDGEN(100)
> y = (x/10.0d0)^2
> p = PLOT(x,y, $
> XTITLE='X axis title', $
> YTITLE='Y axis title', $
> TITLE ='Test plot title', $
> FONT_SIZE=10)
> p.save, 'test.png', HEIGHT=500
> p.save, 'test.eps'
> END
>
> to generate the two files available at:
> http://ftp.emc.ncep.noaa.gov/jcsda/CRTM/.plots
>
> If this is fixed in v8.3, that would be good to know. Upgrading software
> involves some signage away of offspring, so any supporting info helps.
> :o) (just kidding...mostly)
I converted the EPS file to a raster like this:
cgps2raster, 'test.eps', 'test_eps_to_png.png', width=500
Then, rotated it 90 degrees to compare it to the other PNG file. The
difference is obvious.
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: Font size appearance in function graphics PNG and EPS output [message #86867 is a reply to message #86866] |
Mon, 09 December 2013 06:29   |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
Oh yeah! Didn't think to try that. I just did the same using
ImageMagick's convert. Very clear difference in font size.
cheers,
paulv
On 12/09/13 09:24, David Fanning wrote:
> Paul van Delst writes:
>
>>
>> I ran this:
>>
>> PRO test_plot
>> x = DINDGEN(100)
>> y = (x/10.0d0)^2
>> p = PLOT(x,y, $
>> XTITLE='X axis title', $
>> YTITLE='Y axis title', $
>> TITLE ='Test plot title', $
>> FONT_SIZE=10)
>> p.save, 'test.png', HEIGHT=500
>> p.save, 'test.eps'
>> END
>>
>> to generate the two files available at:
>> http://ftp.emc.ncep.noaa.gov/jcsda/CRTM/.plots
>>
>> If this is fixed in v8.3, that would be good to know. Upgrading software
>> involves some signage away of offspring, so any supporting info helps.
>> :o) (just kidding...mostly)
>
> I converted the EPS file to a raster like this:
>
> cgps2raster, 'test.eps', 'test_eps_to_png.png', width=500
>
> Then, rotated it 90 degrees to compare it to the other PNG file. The
> difference is obvious.
>
> Cheers,
>
> David
>
|
|
|
Re: Font size appearance in function graphics PNG and EPS output [message #86869 is a reply to message #86865] |
Mon, 09 December 2013 09:40   |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
I forgot to mention:
IDL> print, !version
{ x86_64 linux unix linux 8.2.2 Jan 23 2013 64 64}
On 12/09/13 09:16, Paul van Delst wrote:
> I ran this:
>
> PRO test_plot
> x = DINDGEN(100)
> y = (x/10.0d0)^2
> p = PLOT(x,y, $
> XTITLE='X axis title', $
> YTITLE='Y axis title', $
> TITLE ='Test plot title', $
> FONT_SIZE=10)
> p.save, 'test.png', HEIGHT=500
> p.save, 'test.eps'
> END
>
> to generate the two files available at:
> http://ftp.emc.ncep.noaa.gov/jcsda/CRTM/.plots
>
> If this is fixed in v8.3, that would be good to know. Upgrading software
> involves some signage away of offspring, so any supporting info helps.
> :o) (just kidding...mostly)
>
> cheers,
>
> paulv
>
> On 12/06/13 18:27, Chris Torrence wrote:
>> On Friday, December 6, 2013 1:54:26 PM UTC-7, Gordon Farquharson
>> wrote:
>>> Hi Paul
>>>
>>>
>>>
>>> I'm surprised nobody has replied to your message yet. I have the
>>> same problem, and I'd really like to know why as well.
>>>
>>>
>>>
>>> Chris, can you comment on this?
>>>
>>>
>>>
>>> Gordon
>>
>> Hi Paul & Gordon,
>>
>> I do know that there were some problems with font sizes in IDL 8.2
>> and earlier. We fixed several issues for IDL 8.3.
>>
>> Do either of you have a simple reproduce case that shows the problem?
>> That way I can try it out and let you know...
>>
>> Thanks!
>>
>> -Chris ExelisVIS
>>
|
|
|
Re: Font size appearance in function graphics PNG and EPS output [message #86870 is a reply to message #86867] |
Mon, 09 December 2013 09:50   |
chris_torrence@NOSPAM
Messages: 528 Registered: March 2007
|
Senior Member |
|
|
Hi Paul,
Well, there are a couple of things going on. The PNG assumes that your screen is 96 dots-per-inch, and scales the fonts accordingly. Since EPS is a vector format on a "piece of paper", you need to set your EPS width to match the PNG image width. Something like this:
p.save, 'test.eps', HEIGHT=500.0/96 ; height in inches
However, there is something wrong with our postscript code where it doesn't draw the plot lines correctly, so this isn't going to work, even in IDL 8.3.
I'm not sure if you have to use EPS, but as a possible workaround, you could use PDF output instead. If you do try PDF, you just need to make sure that you set the "paper" width to be the same as the png image. Something like this:
x = DINDGEN(100)
y = (x/10.0d0)^2
p = PLOT(x,y, $
XTITLE='X axis title', $
YTITLE='Y axis title', $
TITLE ='Test plot title', $
FONT_SIZE=10)
p.save, 'test.png', HEIGHT=500
p.save, 'test.pdf', HEIGHT=500.0/96 ; height in inches
I have logged the EPS issues as bug IDL-68997, and marked it for IDL 8.3.1. Sorry about the bug...
-Chris
ExelisVIS
|
|
|
Re: Font size appearance in function graphics PNG and EPS output [message #86872 is a reply to message #86870] |
Mon, 09 December 2013 10:32   |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
Hi Chris,
Excellent, thanks. The "HEIGHT=500.0/96" tip is also useful - despite
the strange line plotting.
The EPS files are included inside LaTeX (and, in some cases, Word)
documents. I've never tried embedding PDFs inside those (since the final
result is to create a PDF for distro) but I'll give it a shot.
cheers,
paulv
p.s. Schedule for 8.3.1 release?
On 12/09/13 12:50, Chris Torrence wrote:
> Hi Paul,
>
> Well, there are a couple of things going on. The PNG assumes that
> your
screen is 96 dots-per-inch, and scales the fonts accordingly. Since EPS
is a vector format on a "piece of paper", you need to set your EPS width
to match the PNG image width. Something like this:
> p.save, 'test.eps', HEIGHT=500.0/96 ; height in inches However, there
> is something wrong with our postscript code where it
doesn't draw the plot lines correctly, so this isn't going to work, even
in IDL 8.3.
>
> I'm not sure if you have to use EPS, but as a possible workaround,
> you
could use PDF output instead. If you do try PDF, you just need to make
sure that you set the "paper" width to be the same as the png image.
Something like this:
>
> x = DINDGEN(100)
> y = (x/10.0d0)^2
> p = PLOT(x,y, $
> XTITLE='X axis title', $
> YTITLE='Y axis title', $
> TITLE ='Test plot title', $
> FONT_SIZE=10)
> p.save, 'test.png', HEIGHT=500
> p.save, 'test.pdf', HEIGHT=500.0/96 ; height in inches
>
> I have logged the EPS issues as bug IDL-68997, and marked it for IDL
8.3.1. Sorry about the bug...
>
> -Chris
> ExelisVIS
>
|
|
|
Re: Font size appearance in function graphics PNG and EPS output [message #86873 is a reply to message #86872] |
Mon, 09 December 2013 11:20   |
chris_torrence@NOSPAM
Messages: 528 Registered: March 2007
|
Senior Member |
|
|
On Monday, December 9, 2013 11:32:49 AM UTC-7, Paul van Delst wrote:
> Hi Chris,
>
>
>
> Excellent, thanks. The "HEIGHT=500.0/96" tip is also useful - despite
>
> the strange line plotting.
>
>
>
> The EPS files are included inside LaTeX (and, in some cases, Word)
>
> documents. I've never tried embedding PDFs inside those (since the final
>
> result is to create a PDF for distro) but I'll give it a shot.
>
>
>
> cheers,
>
>
>
> paulv
>
>
>
> p.s. Schedule for 8.3.1 release?
>
>
>
> On 12/09/13 12:50, Chris Torrence wrote:
>
>> Hi Paul,
>
>>
>
>> Well, there are a couple of things going on. The PNG assumes that
>
>> your
>
> screen is 96 dots-per-inch, and scales the fonts accordingly. Since EPS
>
> is a vector format on a "piece of paper", you need to set your EPS width
>
> to match the PNG image width. Something like this:
>
>> p.save, 'test.eps', HEIGHT=500.0/96 ; height in inches However, there
>
>> is something wrong with our postscript code where it
>
> doesn't draw the plot lines correctly, so this isn't going to work, even
>
> in IDL 8.3.
>
>>
>
>> I'm not sure if you have to use EPS, but as a possible workaround,
>
>> you
>
> could use PDF output instead. If you do try PDF, you just need to make
>
> sure that you set the "paper" width to be the same as the png image.
>
> Something like this:
>
>>
>
>> x = DINDGEN(100)
>
>> y = (x/10.0d0)^2
>
>> p = PLOT(x,y, $
>
>> XTITLE='X axis title', $
>
>> YTITLE='Y axis title', $
>
>> TITLE ='Test plot title', $
>
>> FONT_SIZE=10)
>
>> p.save, 'test.png', HEIGHT=500
>
>> p.save, 'test.pdf', HEIGHT=500.0/96 ; height in inches
>
>>
>
>> I have logged the EPS issues as bug IDL-68997, and marked it for IDL
>
> 8.3.1. Sorry about the bug...
>
>>
>
>> -Chris
>
>> ExelisVIS
>
>>
Hi Paul,
One other tip - if you aren't trying to edit the EPS files, but you are just embedding them, then you might be better off just going straight to a bitmap file:
p.save, 'test.png', BORDER=10, RESOLUTION=600 ; dots-per-inch
PNG is a pretty efficient file format, so your files won't be too large. You could even cut the resolution down to 300 depending upon the journal requirements.
I also tend to use the BORDER keyword when creating bitmap output. That way I don't have to worry about too much whitespace around the outside of my plots. But that is optional.
Cheers,
Chris
|
|
|
Re: Font size appearance in function graphics PNG and EPS output [message #86874 is a reply to message #86873] |
Mon, 09 December 2013 11:32   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Chris Torrence writes:
> One other tip - if you aren't trying to edit the EPS files, but you are just embedding them, then you might be better off just going straight to a bitmap file:
> p.save, 'test.png', BORDER=10, RESOLUTION=600 ; dots-per-inch
> PNG is a pretty efficient file format, so your files won't be too large. You could even cut the resolution down to 300 depending upon the journal requirements.
> I also tend to use the BORDER keyword when creating bitmap output. That way I don't have to worry about too much whitespace around the outside of my plots. But that is optional.
My book printer requires figures that can be printed at 300 dpi. I
supply them as PNG files embedded into my Framemaker documents. To
create the figures, I simply create PostScript output and then convert
it to PNG with this command:
cgPS2Raster, 'figure.ps', DENSITY=300, RESIZE=100
This gives me an image with enough pixels that it looks great when
printed at 300 dpi. When I import the image into Framemaker, I have to
indicate that it will be printed at 300 dpi. Framemaker then scales it
appropriately for the document on the screen and I see it taking up the
same relative amount of space on my display as it will in the printed
output.
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: Font size appearance in function graphics PNG and EPS output [message #86875 is a reply to message #86872] |
Mon, 09 December 2013 11:42   |
Phillip Bitzer
Messages: 223 Registered: June 2006
|
Senior Member |
|
|
On Monday, December 9, 2013 12:32:49 PM UTC-6, Paul van Delst wrote:
> The EPS files are included inside LaTeX (and, in some cases, Word)
>
> documents. I've never tried embedding PDFs inside those (since the final
>
> result is to create a PDF for distro) but I'll give it a shot.
>
This is why I prefer EPS files as well, in general.
But, if you're not tied to latex (specifically) and can use pdflatex instead, it handles PDF and PNG just fine. (In fact, there's a epstopdf package for just this sort of thing.)
|
|
|
Re: Font size appearance in function graphics PNG and EPS output [message #86876 is a reply to message #86875] |
Mon, 09 December 2013 11:51   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Phillip Bitzer writes:
> This is why I prefer EPS files as well, in general.
>
> But, if you're not tied to latex (specifically) and can use pdflatex instead, it handles PDF and PNG just fine. (In fact, there's a epstopdf package for just this sort of thing.)
I don't use Latex, obviously, and I very rarely ever use EPS files. I
think because I have a nagging suspicion the bounding box IDL uses in
EPS file is screwed up. Have you ever had any problems with this when
working with EPS 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 thue. ("Perhaps thou speakest truth.")
|
|
|
Re: Font size appearance in function graphics PNG and EPS output [message #86877 is a reply to message #86876] |
Mon, 09 December 2013 14:00   |
Phillip Bitzer
Messages: 223 Registered: June 2006
|
Senior Member |
|
|
On Monday, December 9, 2013 1:51:02 PM UTC-6, David Fanning wrote:
> I don't use Latex, obviously, and I very rarely ever use EPS files. I
>
> think because I have a nagging suspicion the bounding box IDL uses in
>
> EPS file is screwed up. Have you ever had any problems with this when
>
> working with EPS files?
>
>
Negatory. In fact, I prefer EPS _because_ it has a bounding box, which plays very nicely with LaTeX. I haven't had a problem with IDL EPS files with latex or pdflatex. (For reference, I use PS_START/END, ... er cgPS_OPEN/CLOSE with /ENCAP set.) Generally speaking, journals prefer EPS, although most (all?) accept PDF as well. To hear Adobe tell it, PDF is more "advanced" than Postscript.
|
|
|
Re: Font size appearance in function graphics PNG and EPS output [message #86879 is a reply to message #86877] |
Mon, 09 December 2013 14:14   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Phillip Bitzer writes:
> Negatory. In fact, I prefer EPS _because_ it has a bounding box, which plays very nicely with LaTeX. I haven't had a problem with IDL EPS files with latex or pdflatex. (For reference, I use PS_START/END, ... er cgPS_OPEN/CLOSE with /ENCAP set.) Generally speaking, journals prefer EPS, although most (all?) accept PDF as well. To hear Adobe tell it, PDF is more "advanced" than Postscript.
Yes, Adobe has a very high opinion of its software. I've recently
switched to the FoxIt PDF Reader so I no longer have to deal with the
Adobe Reader and all the &^$*#@ shortcuts it puts on my desktop when it
installs itself. :-)
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: Font size appearance in function graphics PNG and EPS output [message #88491 is a reply to message #88488] |
Thu, 01 May 2014 17:41   |
chris_torrence@NOSPAM
Messages: 528 Registered: March 2007
|
Senior Member |
|
|
On Thursday, May 1, 2014 5:40:51 PM UTC-6, laura...@gmail.com wrote:
> Q: Will this problem be fixed anytime soon? I went to great lengths to make what I consider a beautiful plot using function graphics and found that the appearance changed completely (both lines and fonts) when I tried to save it in a vector format (eps or pdf). Using a bitmap format works fine. The whole point is that I want to be able to edit the plots. This all works fine using the old style graphics, but I don't think there's a box plot routine for that. (Well, Dave F. probably has one....)
>
>
>
> Incidentally, why are colors always altered in going from RGB to CMYK representation? Surely all imaginable colors can be represented in either system.
>
>
>
> Thx,
>
>
>
> Laura
Hi Laura,
Which version of IDL are you using? There were some bugs related to changing lines & fonts in new graphics, but many of them have been fixed as of IDL 8.3. If you're using IDL 8.3, could you post some sample code which shows the problem?
Cheers,
Chris
ExelisVIS
|
|
|
|