[R] How to stamp my graphs with date and time

David Winsemius dwinsemius at comcast.net
Thu Apr 22 01:02:12 CEST 2010


On Apr 21, 2010, at 6:58 PM, David Winsemius wrote:

> Sarkar offers a worked example of taking user input regarding  
> location for locating a grid viewport outside the plot area.
>
> http://lmdvr.r-forge.r-project.org/figures/figures.html
>
> See Figure 12.1
>
> state <- data.frame(state.x77, state.region)
> trellis.vpname("xlab", prefix = "plot1")
> trellis.vpname("strip", column = 2, row = 2, prefix = "plot2")
>
>
> data(Chem97, package = "mlmRev")
> qqmath(~ gcsescore | factor(score), Chem97, groups = gender,
>       f.value = function(n) ppoints(100),
>       aspect = "xy",
>       page = function(n) {
>           cat("Click on plot to place legend", fill = TRUE)
>           ll <- grid.locator(unit = "npc")
>           if (!is.null(ll))
>               draw.key(simpleKey(levels(factor(Chem97$gender))),
>                        vp = viewport(x = ll$x, y = ll$y),
>                        draw = TRUE)
>       })
>

Furthermore when I try:

mtext(date(), side=3, line=4, adj=0)

.... I get a datetime stamp even though I am mixing graphic paradigms.  
This would seem to be one of those instances where you needn't worry  
about getting the internal coordinates to match up.

> -- 
> David.
>
> On Apr 21, 2010, at 6:32 PM, Jun Shen wrote:
>
>> Thanks, David.
>>
>> mtext is for "graphics". Is there an equivalent function for  
>> "lattice"?
>>
>> Jun
>>
>> On Wed, Apr 21, 2010 at 4:44 PM, David Winsemius <dwinsemius at comcast.net 
>> > wrote:
>>
>> On Apr 21, 2010, at 5:41 PM, Jun Shen wrote:
>>
>> Dear all,
>>
>> How do stamp my graphs with date and time somewhere like left  
>> corner of the
>> graph (not the plotting area). I know date() and Sys.time(), but  
>> where to?
>> Thanks.
>>
>> ?mtext
>>
>>
>> Jun
>>
>>       [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>> David Winsemius, MD
>> West Hartford, CT
>>
>>
>
> David Winsemius, MD
> West Hartford, CT
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list