[R] Putting obejct into Graph title
Jonathan Rougier
J.C.Rougier at durham.ac.uk
Tue May 7 18:38:37 CEST 2002
Andrea Peters wrote:
>
> > If I want to put mean value of a matrix into the title or subtitle of a graph, how would I do this? For example, in a set of commands like below,
> >
> > > m.mean<-mean(m)
> > > gplot (m, thresh=m.mean)
> > > title (main="A2. Block Density of Matrix m\nplotted based on MDS",
> > + sub="lines below mean density (**0.435**) suppressed")
> >
> To get the whole expression into the subtitle you could use paste().
>
> title (main="A2. Block Density of Matrix m\nplotted based on MDS",
> sub=paste("lines below mean density", m.mean, "suppressed"))
You might also want to introduce some simple formatting. From R-1.5.0
you can use the "sprintf" function rather than "paste" to do
title(main = "A2. Block Density of Matrix m\nplotted based on MDS",
sub = sprintf("lines below mean density (%.3f) suppressed", m.mean))
Jonathan.
--
Jonathan Rougier Science Laboratories
Department of Mathematical Sciences South Road
University of Durham Durham DH1 3LE
tel: +44 (0)191 374 2361, fax: +44 (0)191 374 7388
http://www.maths.dur.ac.uk/stats/people/jcr/jcr.html
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list