🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: aus.stats.s
Article #168

outer margin titles and dating of plots

#168
From: Frank Harrell
Date: Tue, 06 Oct 1992 21:35
128 lines
3601 bytes
Here is a little function `mtitle' which I have found useful. I use it
mostly for its automatic dating feature for (multi-image) plots.

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	mtitle.README
#	mtitle.s
#	.Data/.Help/mtitle
# This archive created: Tue Oct  6 13:40:23 1992
export PATH; PATH=/bin:/usr/bin:$PATH
if test -f 'mtitle.README'
then
	echo shar: "will not over-write existing file 'mtitle.README'"
else
cat << \SHAR_EOF > 'mtitle.README'
mtitle		Margin titles with (by default) current date

Created by Frank Harrell (feh@biostat.mc.duke.edu)

To install the program and help file, place this file in your local
library directory $SHOME/library/local.  (Type !echo $SHOME while under
S if you need to find out what $SHOME is).  Then type sh fff, where fff
is the name you stored this shar file under.  This will create 3 more
files: mtitle.README, mtitle.s and .Data/.Help/mtitle.

COPYRIGHT NOTICE

You may distribute these functions freely as long as you do so without
financial gain, that you acknowledge the source, and that you
communicate improvements to the author.

The author is willing to help with problems.  Send E-mail to
feh@biostat.mc.duke.edu (INTERNET) or harre002.dukemc (BITNET).















SHAR_EOF
fi
if test -f 'mtitle.s'
then
	echo shar: "will not over-write existing file 'mtitle.s'"
else
cat << \SHAR_EOF > 'mtitle.s'
mtitle <- function(main="",ll="",lc="",
	lr=unix("date '+%d%h%y'"),cex.m=1.75,cex.l=1)							{

		if(main!="")mtext(main,cex=cex.m,outer=T)
		if(lc!="") mtext(lc,side=1,outer=T,cex=cex.l)
		if(ll!="") mtext(ll,side=1,adj=0,outer=T,cex=cex.l)
		if(lr!="") mtext(lr,side=1,adj=1,outer=T,cex=cex.l)	}

SHAR_EOF
fi
if test -f '.Data/.Help/mtitle'
then
	echo shar: "will not over-write existing file '.Data/.Help/mtitle'"
else
cat << \SHAR_EOF > '.Data/.Help/mtitle'
.BG
.FN mtitle
.TL
Margin Titles
.DN
write overall titles and subtitles after a multiple image plot is drawn
.CS
mtitle(main="", ll="", lc="", lr=unix("date '+%d%h%y'"), 
	cex.m=1.75, cex.l=1)
.RA
none
.OA
.AG main
main title to be centered over entire figure, default is none
.AG ll
subtitle for lower left of figure, default is none
.AG lc
subtitle for lower center of figure, default is none
.AG lr
subtitle for lower right of figure, default is today's date in format
23Jan91
.AG cex.m
character size for main, default is 1.75
.AG cex.l
character size for subtitles, default is 1
.RT
nothing
.SH AUTHOR
Frank Harrell
.sp 0
Division of Biometry, Duke U. Medical Center
.sp 0
feh@biostat.mc.duke.edu
.SE
plots
.SA
par, mtext, unix
.EX
#Set up for 1 plot on figure, give a main title,
#use date for lr
par(oma=c(1.5,0,1.5,0))
plot(x,y)
mtitle("Main Title")

#Set up for 3 x 4 matrix of plots with a lower left subtitle
par(mfrow=c(3,4), oma=c(3,0,3,0))
plot(x,y)
plot(x2,y2) ....
mtitle("Main Title",ll="n=1000")
.KW hplot
.WR
SHAR_EOF
fi
exit 0
#	End of shell archive
Technical Details
Message-ID: <9210061811.AA15311@biostat.mc.duke.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!metro!dmssyd.syd.dms.CSIRO.AU!news

Show Full Headers
Complete Article Headers
Newsgroups: aus.stats.s
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!metro!dmssyd.syd.dms.CSIRO.AU!news
From: feh@biostat.mc.duke.edu (Frank Harrell)
Subject: outer margin titles and dating of plots
Message-ID: <9210061811.AA15311@biostat.mc.duke.edu>
X-Gateway: dmssyd.syd.dms.CSIRO.AU
Lines:  129
Sender: root@syd.dms.CSIRO.AU
Organization: CSIRO Div. Maths & Stats, CSIRO Div. Applied Physics
Date: Tue, 6 Oct 1992 21:35:08 GMT