Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
############################################################### ## ## ## R: Good practice - adding footnotes to graphics ## ## ## ############################################################### # basic information at the beginning of each script scriptName <- "filename.R" author <- "mh" footnote <- paste(scriptName, format(Sys.time(), "%d %b %Y"), author, sep=" / ") # default footnote is today's date, cex=.7 (size) and color # is a kind of grey makeFootnote <- function(footnoteText= format(Sys.time(), "%d %b %Y"), size= .7, color= grey(.5)) { require(grid) pushViewport(viewport()) grid.text(label= footnoteText , x = unit(1,"npc") - unit(2, "mm"), y= unit(2, "mm"), just=c("right", "bottom"), gp=gpar(cex= size, col=color)) popViewport() } makeFootnote(footnote) ## Example ## plot(1:10) makeFootnote(footnote) ###############################################################
Here an example of a footnote added to the graphical output.
Cheers, Mark
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.