Internet-Defense-League

2011-12-12

Semi-transparent colors and EMF -- an open problem

One nice development in visualisation  -- in principle -- is the use of semi-transparent colors. You can use it to plot probability densities, overlapping histograms, surfaces, and maybe other nice things.

In practice, however, semi-transparent colors suck. Unless you are happy with PNG or PDF for monitor use only, stay away from them. That's my advise. Especially if you are stuck to the windows platform, and want to produce an "enhanced" meta file (EMF) for your word document, chances are you will break out in tears if you try semi-transparent colors.

The problem seems to be the EMF format. Here are some of my experiences of what does *not* work in this setting.

Microsoft office inherent problems
One would expect that Microsoft's office programs work flawless with its proprietary vector-graphic format EMF. But they do not.
  • You can not rely that your Powerpoint graphic with semi-transparent colors will print out properly, neither from powerpoint nor if you copy it to word first.
  • You can not save your word doc as PDF if it contains semi-transparent colors and assume the PDF will contain semi-transparent colors, too.

Problems converting PDF to EMF
Since R's emf() device does explicitly not support semi-transparent colors, one option might be to first export the graphic to PDF or SVG, and then convert it to EMF. I did not succeed on this.
  • a software called pdf reader produces something semi-transparent, but of very poor quality
  • Inkscape's and pstoedit's exported EMF displays semi-transparent color as solid colors
  • pdf2picture has not provided an answer
  • I did not find any converter from SVG to EMF

Other options
So, if your end product is not a SVG, PNG or PDF file not intended for printing, it might be better not to use semi-transparent colors. If you are visualising a probability density, try sampling or the hexbin package.

No comments: