ggplot graphs in publications?

[This article was first published on Matt's Stats n stuff » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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

theme_set(theme_bw())
theme_update(
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.size=unit(lkey,”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)
)


To leave a comment for the author, please follow the link and comment on their blog: Matt's Stats n stuff » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)