ggplot graphs in publications?

The grey background and/or default choice of colours for groups makes a ggplot graph stand out to any R user when seen in a presentation. But ggplot graphs get all ninja when it comes to publications, either that or not a lot of graphs generated using ggplot have been published in the journal I read (health research (epidemiology/diabetes largely). Like many others ggplot is my go to graphing package and I’ve prepared graphs using ggplot that have been published in the past.

More recently I was working on a paper that was submitted to the New England Journal of Medicine, don’t worry, it was returned within a few days. Their specs for figures are very open, literally just listing a bunch of file types. But other journals like diabetes care have much more detailed instructions, 6.11 listing widths and font sizes, and choices of points for points on graphs. Then there are their more daunting Digital Art Guidelines, where we get into RGB vs CMYK and font families and what not.

This was raised in 2010 and then again by me earlier this year, around having a ‘theme library’ where users contribute standardised settings so plots conform to journal guidelines, much in the same way that endnote/papers etc have referencing styles specific to journals. Below is an example of something I ended up with in the past. Hideous, after a number of bandaids to get to something that conformed to the requirements I was working to. This being pre the move to ‘elements’ from ‘theme’.

Have you got similar examples? Is it destined to always be this messy? Am I missing something blatantly obvious?

tsize <- 9; tsize2 <- 8; pchsize <- 1; lkey <- 3.5 # lsize <- 0.3

plot.margin = unit(c(0.4,0.5,0.1,0), “lines”),
panel.margin = unit(0.25, “lines”),
panel.grid.minor = theme_line(colour = NA),
panel.grid.major = theme_line(colour = NA),
panel.background=theme_rect(fill = NA, colour = “black”),
panel.border = theme_rect(colour=”black”, size=0),
plot.title = theme_text(size = tsize, vjust = 0.5, hjust=0),
axis.title.x = theme_text(size = tsize, vjust = 0.35),
axis.title.y = theme_text(size = tsize, hjust = 0.5, vjust = 0.4, angle = 90),
axis.text.x = theme_text(size = tsize2),
axis.text.y = theme_text(size = tsize2),
axis.ticks.margin=unit(0.5, units=”mm”),
axis.ticks.length=unit(1, units=”mm”),
#axis.line = theme_segment(colour = ‘black’, size = 1),
legend.key=theme_rect(colour = NA),
legend.title=theme_text(size = tsize2-1, hjust = 0),
legend.text=theme_text(size = tsize2-1, hjust = 0),
legend.background=theme_rect(colour=NA, size=0),
legend.margin = unit(0, “mm”),
legend.key.width = unit(lkey*1.5, “mm”),
strip.background = theme_rect(fill = NA, linetype=NULL, size=0, colour=”white”),
strip.text.x = theme_text(size=tsize, vjust=0.7, hjust= 0.5)

4 thoughts on “ggplot graphs in publications?

  1. HeyHo,
    I just recently started getting into R, but are currently preparing a publication with growth curves and other simple xy-data. In general I like your idea, but have to admit that the R output is not sufficient for my needs. I export the graphs and polish them with inkscape, which would render every theme useless….

  2. Hi,
    I am currently not using ggplot but base graphics, seldom followed by inkscape. I have looked into ggplot at times but found that it is very different and I have found to many people asking detail questions (order of categories on the x-axis and things like that) which I don’t really want to worry about. What you propose – a good library of journal-suited themes for publication, might be the decinding “one more” point to make ggplot worth the transition for me.
    > Is it destined to always be this messy?
    That looks very much like code that should be written by machines, not by humans. Graphic design is one point where GUIs are superior. Is there any project for a GUI-driven software to build themes?

    I like this post a lot,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s