greenelab / xswap-analysis

Analysis and experiments for https://github.com/greenelab/xswap-manuscript
BSD 3-Clause "New" or "Revised" License
3 stars 1 forks source link

Add PDF format figures #28

Closed zietzm closed 10 months ago

zietzm commented 10 months ago

References this discussion in https://github.com/greenelab/xswap-manuscript/issues/69.

dhimmel commented 10 months ago

Nice!

What method did you use to create the eps files? ggplot2::ggsave in R?

Things look good except for any elements involving transparency. For example, a screenshot of auroc_dists.eps from my desktop Evince viewer:

image

Notice how the points, which have transparency, have been rasterized.

Apparently, there might be an R fallback_resolution argument for "the resolution in dpi used when falling back to bitmap output" that we could increase to 600. But that wouldn't fix the underlying problem that EPS does not support transparency and hence transparent items are rasterized.

From the stack:

The PostScript graphics model itself does not support general transparency of page elements at all. (Hence it is also not possible for EPS.) PostScript colors are all fully opaque.

An object drawn on top of another object would overwrite and cover all lower objects with its own color leaving no room for transparent effects. (If you see something that looks like transparency overlays in a PostScript viewer or printout, then that was only emulated transparency, by flattening the two (or more) respective objects into one single rasterized area creating the illusion of transparency.)

If you must use EPS, use a two-step process:

  • Create the PDF first.
  • Then convert from the (transparency-enabled) PDF to EPS, 'flattening' the transparent elements into rasterized areas which emulate the desired transparency effect.

For connectivity search, we had some luck first creating a PDF and then running pdftops -rasterize never. But output must be checked.

So if not too much of a pain, I think we should export to PDF. And then we can see if we can get emulated vector transparency via a different program for converting PDF to EPS. I'll comment on individual files if things already look good.

zietzm commented 10 months ago

What method did you use to create the eps files? ggplot2::ggsave in R?

Exactly! I just modified the extension in each file name.

Regarding Gigascience, is there a reason we prefer EPS over PDF for vector graphics? It seems like Gigascience prefers PDF.

dhimmel commented 10 months ago

Regarding Gigascience, is there a reason we prefer EPS over PDF for vector graphics?

Ah wow the instructions to authors does say:

Vector figures should if possible be submitted as PDF files, which are usually more compact than EPS files.

Submitting PDFs would be infinitely better and easier than EPS files! But now I'm sort of confused why Gigascience/Aptara requesed EPS files for connectivity search in order to create vectors instead of PDF. So let's try PDF and see what happens.

zietzm commented 10 months ago

Ok! I'll push one more commit that just puts all the figures into PDF format then.