[R] title problem
David Winsemius
dwinsemius at comcast.net
Sat Nov 21 19:09:10 CET 2009
On Nov 21, 2009, at 12:57 PM, Gabor Grothendieck wrote:
> Try the line= argument on title()
>
> opar <- par(oma = 4 * c(1, 1, 1, 1), no.readonly = TRUE)
> par(mfrow = 1:2)
> plot(1:3, 9:7)
> plot(1:3, 7:9)
> for(i in 1:3) title(main = i, line = i, outer = TRUE)
> par(opar)
>
I was not sure what Carol was hoping for. I assumed she was hoping for
the full page analog of what subtitle would do with an individual
plot, i.e. that the subtitle would be below the plots and centered. If
she were hoping for just another line below the main title, then your
strategy or using "\n" within the string would be effective.
I think that she may need to use mtext() in order to get a "true" sub-
title of the first sort.
--
David.
>
> On Sat, Nov 21, 2009 at 12:47 PM, carol white <wht_crl at yahoo.com>
> wrote:
>> Thanks Gary. No I want one subtitle for all plots below the main
>> title. subtitle should work but if doesn't at the worst case I
>> could do as follows:
>>
>> title(main = "Main title\nSub title",outer = TRUE, cex.main=1.5,...)
>>
>> --- On Sat, 11/21/09, Gary <mail2garymiller at gmail.com> wrote:
>>
>>> From: Gary <mail2garymiller at gmail.com>
>>> Subject: Re: [R] title problem
>>> To: "David Winsemius" <dwinsemius at comcast.net>
>>> Cc: "carol white" <wht_crl at yahoo.com>, "r-help list" <r-help at r-project.org
>>> >
>>> Date: Saturday, November 21, 2009, 9:39 AM
>>> You are right David/Carol. It seems outer=T
>>> does not work for "Sub title". I'm not sure
>>> what Carol is looking for, but in case you need separate sub
>>> titles for each graph, then you may want to use more than
>>> one title statement. Like:
>>>
>>>
>>> par(oma=c(2,2,2,2))par(mfrow =
>>> c(1,2))plot(c(1,2,3),
>>> c(9,8,7))title(sub ="sub title 1",
>>> cex.sub = 0.75)plot(c(1,2,3),
>>> c(9,8,7))title(sub ="sub title 2",
>>> cex.sub = 0.75)
>>>
>>> title(main = "Main title",
>>> cex.main=1.5, outer = TRUE)
>>> Not sure about how to do it for a single
>>> "sub title" for whole graph.
>>> Anyone?~Gary
>>>
>>>
>>>
>>>
>>> On Sat, Nov 21, 2009 at 12:07 PM,
>>> David Winsemius <dwinsemius at comcast.net>
>>> wrote:
>>>
>>>
>>>
>>>
>>> On Nov 21, 2009, at 11:39 AM, Gary wrote:
>>>
>>>
>>>
>>>
>>> Hi Carol,
>>>
>>>
>>>
>>> Try this
>>>
>>>
>>>
>>>
>>> par(oma=c(2,2,2,2))
>>>
>>> par(mfrow = c(1,2))
>>>
>>> plot(c(1,2,3), c(9,8,7))
>>>
>>> plot(c(1,2,3), c(9,8,7))
>>>
>>> title(main = "Main title", sub ="Sub
>>> title",outer = TRUE, cex.main=1.5,
>>>
>>>
>>> cex.sub = 1.5)
>>>
>>>
>>>
>>>
>>> I'm curious about what you are seeing with that
>>> sequence. On a Mac running R 2.10.0 I am not seeing the
>>> subtitle.
>>>
>>>
>>>
>>> --
>>>
>>> David
>>>
>>>
>>>
>>>
>>> par(oma=c(2,2,2,2)) -- can be used to define outline of the
>>> plot. Arguments
>>>
>>> here are for "bottom", "left",
>>> "top", "right"; which ofcourse can be
>>> changed
>>>
>>> according to need. HTH
>>>
>>>
>>>
>>> ~Gary
>>>
>>>
>>>
>>> On Sat, Nov 21, 2009 at 11:21 AM, carol white <wht_crl at yahoo.com>
>>> wrote:
>>>
>>>
>>>
>>>
>>> Hi,
>>>
>>> I got problem in using title function to create a title for
>>> multiple plots
>>>
>>> presented together by par. As can be seen in the attached
>>> file, the title is
>>>
>>> displayed truncated and the subtitle doesn't get
>>> displayed. Here is the
>>>
>>> code:
>>>
>>>
>>>
>>> par(mfrow = c(1,2))
>>>
>>> plot(c(1,2,3), c(9,8,7))
>>>
>>> plot(c(1,2,3), c(9,8,7))
>>>
>>> title(main = "Main title", sub ="Sub
>>> title",outer = TRUE, cex.main=1.5,
>>>
>>> cex.sub = 1.5)
>>>
>>>
>>>
>>> Carol
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> ______________________________________________
>>>
>>> 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.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> [[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
>>>
>>> Heritage Laboratories
>>>
>>> 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.
>>
>
> ______________________________________________
> 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
Heritage Laboratories
West Hartford, CT
More information about the R-help
mailing list