Itay Furman wrote:> Dear R users, > > Sometimes, for tracking purposes, I am interested to add to a > plot some metadata such as > * the date it was produced > * filename that stores the plot > * perhaps data sources, author, etc > > Ideally, I would like to be able to do this for any kind of plot, > plot(), barplot(), hist(), etc.; and, to be able to produce > plots with or without the metadata by a simple toggle mechanism. > > Something like: > > # 'Clean' plot > some.plot.func(<args>) # plot() or barplot() or ... > > # Now with metadata > options(metadata=TRUE) # Or some other toggle mechanism > > some.plot.func(<args>) # Same plot as above, but with wider > # bottom margins that show the > # metadata. > > So far I looked in "Introduction to R" and tried to find hints > using help.search() without success. > > Is it possilbe to do? > Any suggestions or pointers as to how to do it are appreciated. > Even partial solution in which the plot is set up to accomodate > metadata in the margins, but the data needs to be added manually > after plot()ting will be great. > > Thanks in advance, > Itay > > -------------------------------------------------------------- > itayf at fhcrc.org Fred Hutchinson Cancer Research CenterTake a look at the pstamp function in the Hmisc package. -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University
Dear R users, Sometimes, for tracking purposes, I am interested to add to a plot some metadata such as * the date it was produced * filename that stores the plot * perhaps data sources, author, etc Ideally, I would like to be able to do this for any kind of plot, plot(), barplot(), hist(), etc.; and, to be able to produce plots with or without the metadata by a simple toggle mechanism. Something like: # 'Clean' plot some.plot.func(<args>) # plot() or barplot() or ... # Now with metadata options(metadata=TRUE) # Or some other toggle mechanism some.plot.func(<args>) # Same plot as above, but with wider # bottom margins that show the # metadata. So far I looked in "Introduction to R" and tried to find hints using help.search() without success. Is it possilbe to do? Any suggestions or pointers as to how to do it are appreciated. Even partial solution in which the plot is set up to accomodate metadata in the margins, but the data needs to be added manually after plot()ting will be great. Thanks in advance, Itay -------------------------------------------------------------- itayf at fhcrc.org Fred Hutchinson Cancer Research Center
I would take the metadata and plot it at the bottom (or top - your preference) using mtext. Check out the options oma and the usage of mtext. Partha Itay Furman <itayf@fhcrc.org> Sent by: r-help-bounces@stat.math.ethz.ch 06/14/2004 03:17 PM Please respond to Itay Furman To: r-help@stat.math.ethz.ch cc: Subject: [R] How to 'stamp' a plot with meta-data? Dear R users, Sometimes, for tracking purposes, I am interested to add to a plot some metadata such as * the date it was produced * filename that stores the plot * perhaps data sources, author, etc Ideally, I would like to be able to do this for any kind of plot, plot(), barplot(), hist(), etc.; and, to be able to produce plots with or without the metadata by a simple toggle mechanism. Something like: # 'Clean' plot some.plot.func(<args>) # plot() or barplot() or ... # Now with metadata options(metadata=TRUE) # Or some other toggle mechanism some.plot.func(<args>) # Same plot as above, but with wider # bottom margins that show the # metadata. So far I looked in "Introduction to R" and tried to find hints using help.search() without success. Is it possilbe to do? Any suggestions or pointers as to how to do it are appreciated. Even partial solution in which the plot is set up to accomodate metadata in the margins, but the data needs to be added manually after plot()ting will be great. Thanks in advance, Itay -------------------------------------------------------------- itayf@fhcrc.org Fred Hutchinson Cancer Research Center ______________________________________________ R-help@stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html [[alternative HTML version deleted]]
I use this little function for adding a datestamp manually. runstamp <- function (adj = 1, cex = 0.75, line = 4) mtext(format(Sys.time()), side = 1, adj = adj, cex = cex, line = line) Since the default lower margin is 5.1, line = 4 works pretty well. You can, of course, put any other information you want in there. But to have it all automated looks to me like a major task. I wouldn't get my hopes up. At 12:17 PM -0700 6/14/04, Itay Furman wrote:>Dear R users, > >Sometimes, for tracking purposes, I am interested to add to a >plot some metadata such as >* the date it was produced >* filename that stores the plot >* perhaps data sources, author, etc > >Ideally, I would like to be able to do this for any kind of plot, >plot(), barplot(), hist(), etc.; and, to be able to produce >plots with or without the metadata by a simple toggle mechanism. > >Something like: > ># 'Clean' plot >some.plot.func(<args>) # plot() or barplot() or ... > ># Now with metadata >options(metadata=TRUE) # Or some other toggle mechanism > >some.plot.func(<args>) # Same plot as above, but with wider > # bottom margins that show the > # metadata. > >So far I looked in "Introduction to R" and tried to find hints >using help.search() without success. > >Is it possilbe to do? >Any suggestions or pointers as to how to do it are appreciated. >Even partial solution in which the plot is set up to accomodate >metadata in the margins, but the data needs to be added manually >after plot()ting will be great. > > Thanks in advance, > Itay > >-------------------------------------------------------------- >itayf at fhcrc.org Fred Hutchinson Cancer Research Center > >______________________________________________ >R-help at stat.math.ethz.ch mailing list >https://www.stat.math.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html-- -------------------------------------- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA