An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130103/fbcf71a1/attachment-0001.pl>
two lines in axis title combined with 'substitute' command
4 messages · N.Hubner at ncmls.ru.nl, Uwe Ligges, David Winsemius
On 03.01.2013 15:00, N.Hubner at ncmls.ru.nl wrote:
Hello, I want to have the x-axis title of my plot in 2 lines, centered: experiment 1: log2(Ratio H/L) I know that in principle that works with '\n'. However, I am also using the 'substitute' command for my axis title. However, it does not make a new line.
You cannot. One way out is to use two calls to title(xlab=...., line=...), one for each line of the xlab title. Best, Uwe Ligges
What I have so far:
logbase <- 2
test <- "bait"
cellline <- "cellline"
plot(
log(filteredproteins[["Ratio.H.L.normalized.UW21_FW"]],base=logbase),
-log(filteredproteins[["Ratio.H.L.normalized.UW21_REV"]],base=logbase),
main= substitute("bait = "* bait *" in "*cellline, list(bait=bait, cellline=cellline)),
xlab = substitute(
log[logbase]*
("Ratio H"/"L forward")*
italic("\n experiment 1"),
list(logbase=logbase)
),
ylab = substitute(
log[logbase]*
("Ratio L"/"H reverse")*
italic("\n experiment 2"),
list(logbase=logbase)
),
col="lightblue",
bg="black",
pch=16
)
Thanks for your help!
Nina
The Radboud University Nijmegen Medical Centre is listed in the Commercial Register of the Chamber of Commerce under file number 41055629.
[[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.
On Jan 3, 2013, at 8:00 AM, Uwe Ligges wrote:
On 03.01.2013 15:00, N.Hubner at ncmls.ru.nl wrote:
Hello, I want to have the x-axis title of my plot in 2 lines, centered: experiment 1: log2(Ratio H/L) I know that in principle that works with '\n'. However, I am also using the 'substitute' command for my axis title. However, it does not make a new line.
You cannot.
That has been my experience and I believe it is documented on the help(plotmath) page.
One way out is to use two calls to title(xlab=...., line=...), one for each line of the xlab title.
Another way would be with the use of the 'atop' function.
substitute( atop(
log[logbase]* ("Ratio L"/"H reverse"),
italic("experiment 2")
), list(logbase=logbase)
)
Returns:
atop(log[2] * ("Ratio L"/"H reverse"), italic("experiment 2"))
David.
>
> Best,
> Uwe Ligges
>
>
>>
>> What I have so far:
>>
>> logbase <- 2
>> test <- "bait"
>> cellline <- "cellline"
>>
>> plot(
>> log(filteredproteins[["Ratio.H.L.normalized.UW21_FW"]],base=logbase),
>> -
>> log
>> (filteredproteins[["Ratio.H.L.normalized.UW21_REV"]],base=logbase),
>> main= substitute("bait = "* bait *" in "*cellline, list(bait=bait,
>> cellline=cellline)),
>> xlab = substitute(
>> log[logbase]*
>> ("Ratio H"/"L forward")*
>> italic("\n experiment 1"),
>> list(logbase=logbase)
>> ),
>> ylab = substitute(
>> log[logbase]*
>> ("Ratio L"/"H reverse")*
>> italic("\n experiment 2"),
>> list(logbase=logbase)
>> ),
>> col="lightblue",
>> bg="black",
>> pch=16
>> )
>>
>> Thanks for your help!
>> Nina
>>
>>
>>
>> The Radboud University Nijmegen Medical Centre is listed in the
>> Commercial Register of the Chamber of Commerce under file number
>> 41055629.
>>
>>
>> [[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.
>>
>
> ______________________________________________
> 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
Alameda, CA, USA
Hi! Thanks a lot for your help! I now do have exactly the plot that I wanted! (I also realized that I have to use the 'text' command outside of the plot function; beginners mistake :-) Cheers, Nina ______________________________________________ Dr. Nina Hubner scientist quantitative proteomics Dep. of Molecular Biology, Radboud University Nijmegen, The Netherlands e-mail: n.hubner at ncmls.ru.nl tel: +31-24-3613655 Visiting address: NCMLS, Dept of Molecular Biology (route 274) Geert Grooteplein 26/28 6525 GA Nijmegen The Netherlands
From: David Winsemius [dwinsemius at comcast.net]
Sent: Thursday, January 03, 2013 5:28 PM
To: Uwe Ligges
Cc: Hubner, Nina; r-help at r-project.org
Subject: Re: [R] two lines in axis title combined with 'substitute' command
Sent: Thursday, January 03, 2013 5:28 PM
To: Uwe Ligges
Cc: Hubner, Nina; r-help at r-project.org
Subject: Re: [R] two lines in axis title combined with 'substitute' command
On Jan 3, 2013, at 8:00 AM, Uwe Ligges wrote:
>
>
> On 03.01.2013 15:00, N.Hubner at ncmls.ru.nl wrote:
>> Hello,
>>
>> I want to have the x-axis title of my plot in 2 lines, centered:
>>
>> experiment 1:
>> log2(Ratio H/L)
>>
>> I know that in principle that works with '\n'. However, I am also
>> using the 'substitute' command for my axis title. However, it does
>> not make a new line.
>
> You cannot.
That has been my experience and I believe it is documented on the
help(plotmath) page.
> One way out is to use two calls to title(xlab=...., line=...), one
> for each line of the xlab title.
Another way would be with the use of the 'atop' function.
substitute( atop(
log[logbase]* ("Ratio L"/"H reverse"),
italic("experiment 2")
), list(logbase=logbase)
)
Returns:
atop(log[2] * ("Ratio L"/"H reverse"), italic("experiment 2"))
--
David.
>
> Best,
> Uwe Ligges
>
>
>>
>> What I have so far:
>>
>> logbase <- 2
>> test <- "bait"
>> cellline <- "cellline"
>>
>> plot(
>> log(filteredproteins[["Ratio.H.L.normalized.UW21_FW"]],base=logbase),
>> -
>> log
>> (filteredproteins[["Ratio.H.L.normalized.UW21_REV"]],base=logbase),
>> main= substitute("bait = "* bait *" in "*cellline, list(bait=bait,
>> cellline=cellline)),
>> xlab = substitute(
>> log[logbase]*
>> ("Ratio H"/"L forward")*
>> italic("\n experiment 1"),
>> list(logbase=logbase)
>> ),
>> ylab = substitute(
>> log[logbase]*
>> ("Ratio L"/"H reverse")*
>> italic("\n experiment 2"),
>> list(logbase=logbase)
>> ),
>> col="lightblue",
>> bg="black",
>> pch=16
>> )
>>
>> Thanks for your help!
>> Nina
>>
>>
>>
>> The Radboud University Nijmegen Medical Centre is listed in the
>> Commercial Register of the Chamber of Commerce under file number
>> 41055629.
>>
>>
>> [[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.
>>
>
> ______________________________________________
> 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
Alameda, CA, USA
The Radboud University Nijmegen Medical Centre is listed in the Commercial Register of the Chamber of Commerce under file number 41055629.