This is a bit of a follow-up to the previous discussion about how to
plot large datasets. I was doing a scatterplot of 5,000 points with
transparency, saved as an encapsulated postscript file (EPS). The
postscript driver in R had not recorded transparency in the past so I
was double-checking it. Sure enough, the axes were there, but points
had vanished (a bit TOO transparent.)
So I switched to PDF, which gave me a 1 MB file in nice, high
resolution. But my publisher (Springer) prefers EPS. I happened to have
Adobe Acrobat Professional, so I used it to convert to EPS just to make
sure the lack of transparency is an EPS problem, not an R problem. To my
surprise, the transparency appeared and looked fine! So it seems that
the R postscript driver has a problem.
Unfortunately, the PDF to EPS conversion ballooned the file from 1 MB to
77 MB! Simply viewing it in LaTeX (Yap) took several minutes.
I then saved as a 600 dpi PNG file and it looks great at only 340KB! So
Hadley's advice on this is good. And I think R's postscript driver
(which creates EPS) has a bug, or perhaps they just did not view
transparency as important.
This applies to confidence bands around regression lines since they use
transparency. They don't get huge in EPS but the do disappear when using
R's postscritpt driver.
Cheers,
Bob
=========================================================
Bob Muenchen (pronounced Min'-chen),
Manager, Research Computing Support
U of TN Office of Information Technology
Stokely Management Center, Suite 200
916 Volunteer Blvd., Knoxville, TN 37996-0520
Voice: (865) 974-5230
FAX: (865) 974-4810
Email: muen...@utk.edu
Web: http://oit.utk.edu/research <http://oit.utk.edu/scc>
Map to Office: http://www.utk.edu/maps
Newsletter: http://listserv.utk.edu/archives/rcnews.html
<http://listserv.utk.edu/archives/statnews.html>
=========================================================
> I then saved as a 600 dpi PNG file and it looks great at only 340KB! So
> Hadley's advice on this is good. And I think R's postscript driver
> (which creates EPS) has a bug, or perhaps they just did not view
> transparency as important.
This is not a bug. PostScript (PS/EPS) just does not support (alpha)
transparency.
--
Karl Ove Hufthammer
> To my
> surprise, the transparency appeared and looked fine! So it seems that
> the R postscript driver has a problem.
No EPS, as a format, does not support transparency. see the comparison
between PDF and postscript about that:
http://en.wikipedia.org/wiki/Portable_Document_Format#Transparency
So what acrobat likely does is to convert the transparent parts into a
bitmap.
> Unfortunately, the PDF to EPS conversion ballooned the file from 1
> MB to
> 77 MB! Simply viewing it in LaTeX (Yap) took several minutes.
Judging from the size, acrobat must be producing a uncompressed TIFF
of high density for the transparent parts. However, if you can zoom
enough you should see some pixels.
> I then saved as a 600 dpi PNG file and it looks great at only 340KB!
> So
> Hadley's advice on this is good.
Hadley's advice is always good! ;)
However... ask the publisher before hand. First, most page layout
software (from LaTeX to Quark or InDesign) support PDF. So the
requirement for EPS is probably something that carried over from old
versions of their workflow. If you argue based on the limitations of
EPS vs. PDF regarding transparency, they should listen (and if they
don't, then they should at least explain heir reasons. Maybe they
don't think transparency s a good idea in the first place because it
prints badly or something).
If you end up needing to go the raster route (PNG) they will probably
have some stupid requirements also (like TIFF). You can convert from
PNG to TIFF with no loss of quality but you should first ask for the
resolution. For professionally printed material, it is not uncommon
for the resolution of the printer to be 1200 dpi and that's usually
what they ask for for line art. In that case you need to produce PNGs
at the correct resolution first.
Good luck with that.
JiHO
---
http://jo.irisson.free.fr/
> It turns out that the PDF to EPS conversion that I did resulted a
> low-res bitmap file stored as EPS! It looked great on the screen but
> looked like 96-dpi (my screen resolution) or so when I printed it.
> Transparency and EPS format seems a bit mysterious as several sources
> say that transparency is supported (in various ways) in EPS (e.g.
> http://en.wikipedia.org/wiki/Transparent_pixels).
As this page says, PostScript only supports clipping and fully
transparent or fully opaque colours, neither which is of much use when
you want *partial* transparency. For that, you need to use PDF (or
SVG, or a raster graphics format such as PNG).
Also note that when printing a PDF containing transparency to a
PostScript printer, Adobe Reader internally rasterises the PDF
(converts it into a bitmap) before sending it.
--
Karl Ove Hufthammer