Plot Header

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Plot Header

Pete Brecknock
Any recommendations for how I can embed my title below in a single red strip/box across the plot area in the outer margin?

I would like to avoid the color appearing in any other area defined by the oma.

# Example Plot
par(mfrow=c(2,2),mar=c(4,4,2,2), oma = c(1, 1, 3, 1))
plot(rnorm(100),1:100)
plot(rnorm(100),1:100)
plot(rnorm(100),1:100)
plot(rnorm(100),1:100)
# Title
title("MY TITLE", outer = TRUE, cex = 1.5, adj=0, col="blue", font=2)

Thanks for any pointers

Pete
Reply | Threaded
Open this post in threaded view
|

Re: Plot Header

David Winsemius

On Jan 15, 2013, at 2:49 PM, Pete Brecknock wrote:

> Any recommendations for how I can embed my title below in a single red
> strip/box across the plot area in the outer margin?
>
> I would like to avoid the color appearing in any other area defined by the
> oma.
>
The code used "blue" ... not sure what that last sentence meant. Or what the "single strip" was supposed to look like.

> # Example Plot
> par(mfrow=c(2,2),mar=c(4,4,2,2), oma = c(1, 1, 3, 1))
> plot(rnorm(100),1:100)
> plot(rnorm(100),1:100)
> plot(rnorm(100),1:100)
> plot(rnorm(100),1:100)
> # Title
> title("MY TITLE", outer = TRUE, cex = 1.5, adj=0, col="blue", font=2)

opar <- par(mfrow=c(2,2),mar=c(4,4,2,2), oma = c(1, 1, 3, 1))
plot(rnorm(100),1:100)
plot(rnorm(100),1:100)
plot(rnorm(100),1:100)
plot(rnorm(100),1:100)

title("MY TITLE", outer = TRUE, cex = 1.5, adj=0, col.main="blue", font=2, adj=0.5)
par(opar)

--
David Winsemius
Alameda, CA, USA

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Plot Header

Pete Brecknock
David Winsemius wrote
On Jan 15, 2013, at 2:49 PM, Pete Brecknock wrote:

> Any recommendations for how I can embed my title below in a single red
> strip/box across the plot area in the outer margin?
>
> I would like to avoid the color appearing in any other area defined by the
> oma.
>
The code used "blue" ... not sure what that last sentence meant. Or what the "single strip" was supposed to look like.

> # Example Plot
> par(mfrow=c(2,2),mar=c(4,4,2,2), oma = c(1, 1, 3, 1))
> plot(rnorm(100),1:100)
> plot(rnorm(100),1:100)
> plot(rnorm(100),1:100)
> plot(rnorm(100),1:100)
> # Title
> title("MY TITLE", outer = TRUE, cex = 1.5, adj=0, col="blue", font=2)

opar <- par(mfrow=c(2,2),mar=c(4,4,2,2), oma = c(1, 1, 3, 1))
plot(rnorm(100),1:100)
plot(rnorm(100),1:100)
plot(rnorm(100),1:100)
plot(rnorm(100),1:100)

title("MY TITLE", outer = TRUE, cex = 1.5, adj=0, col.main="blue", font=2, adj=0.5)
par(opar)

--
David Winsemius
Alameda, CA, USA

______________________________________________
[hidden email] 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.
Thanks for the reply.  

Apologies for the poor description. Let me try again.

The code produces 4 charts in a 2 by 2 matrix

Above these charts I have a single, left justified title in the outer margin.

I would like to embed this title in a box which should run from the left hand side of the screen to the right and be say 10 lines high. I would like to color the box background red, the title "MY TITLE" would appear in blue inside the box. This could be described as a header.  

Any better?
Reply | Threaded
Open this post in threaded view
|

Re: Plot Header

David Winsemius

On Jan 15, 2013, at 3:25 PM, Pete Brecknock wrote:

> David Winsemius wrote
>> On Jan 15, 2013, at 2:49 PM, Pete Brecknock wrote:
>>
>>> Any recommendations for how I can embed my title below in a single red
>>> strip/box across the plot area in the outer margin?
>>>
>>> I would like to avoid the color appearing in any other area defined by
>>> the
>>> oma.
>>>
>> The code used "blue" ... not sure what that last sentence meant. Or what
>> the "single strip" was supposed to look like.
>>
>>> # Example Plot
>>> par(mfrow=c(2,2),mar=c(4,4,2,2), oma = c(1, 1, 3, 1))
>>> plot(rnorm(100),1:100)
>>> plot(rnorm(100),1:100)
>>> plot(rnorm(100),1:100)
>>> plot(rnorm(100),1:100)
>>> # Title
>>> title("MY TITLE", outer = TRUE, cex = 1.5, adj=0, col="blue", font=2)
>>
>> opar <- par(mfrow=c(2,2),mar=c(4,4,2,2), oma = c(1, 1, 3, 1))
>> plot(rnorm(100),1:100)
>> plot(rnorm(100),1:100)
>> plot(rnorm(100),1:100)
>> plot(rnorm(100),1:100)
>>
>> title("MY TITLE", outer = TRUE, cex = 1.5, adj=0, col.main="blue", font=2,
>> adj=0.5)
>> par(opar)
>>
>> --
>> David Winsemius
>> Alameda, CA, USA
>>
>> ______________________________________________
>
>> R-help@
>
>> 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.
>
> Thanks for the reply.  
>
> Apologies for the poor description. Let me try again.
>
> The code produces 4 charts in a 2 by 2 matrix
>
> Above these charts I have a single, left justified title in the outer
> margin.
>
> I would like to embed this title in a box which should run from the left
> hand side of the screen to the right and be say 10 lines high. I would like
> to color the box background red, the title "MY TITLE" would appear in blue
> inside the box. This could be described as a header.  

Admittedly a hack:

opar <- par(mfrow=c(2,2),mar=c(4,4,2,2), oma = c(1, 1, 3, 1))
 plot(rnorm(100),1:100)
 plot(rnorm(100),1:100)
 plot(rnorm(100),1:100)
 plot(rnorm(100),1:100)
 par(opar)
 rect(-5, 110, 5, 120, col="red", xpd=NA)
 title("MY TITLE", outer = TRUE, cex = 1.5, adj=0, col.main="blue", font=2, adj=0.5,line=-2)

--

David Winsemius
Alameda, CA, USA

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Plot Header

Pete Brecknock
David Winsemius wrote
On Jan 15, 2013, at 3:25 PM, Pete Brecknock wrote:

> David Winsemius wrote
>> On Jan 15, 2013, at 2:49 PM, Pete Brecknock wrote:
>>
>>> Any recommendations for how I can embed my title below in a single red
>>> strip/box across the plot area in the outer margin?
>>>
>>> I would like to avoid the color appearing in any other area defined by
>>> the
>>> oma.
>>>
>> The code used "blue" ... not sure what that last sentence meant. Or what
>> the "single strip" was supposed to look like.
>>
>>> # Example Plot
>>> par(mfrow=c(2,2),mar=c(4,4,2,2), oma = c(1, 1, 3, 1))
>>> plot(rnorm(100),1:100)
>>> plot(rnorm(100),1:100)
>>> plot(rnorm(100),1:100)
>>> plot(rnorm(100),1:100)
>>> # Title
>>> title("MY TITLE", outer = TRUE, cex = 1.5, adj=0, col="blue", font=2)
>>
>> opar <- par(mfrow=c(2,2),mar=c(4,4,2,2), oma = c(1, 1, 3, 1))
>> plot(rnorm(100),1:100)
>> plot(rnorm(100),1:100)
>> plot(rnorm(100),1:100)
>> plot(rnorm(100),1:100)
>>
>> title("MY TITLE", outer = TRUE, cex = 1.5, adj=0, col.main="blue", font=2,
>> adj=0.5)
>> par(opar)
>>
>> --
>> David Winsemius
>> Alameda, CA, USA
>>
>> ______________________________________________
>
>> R-help@
>
>> 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.
>
> Thanks for the reply.  
>
> Apologies for the poor description. Let me try again.
>
> The code produces 4 charts in a 2 by 2 matrix
>
> Above these charts I have a single, left justified title in the outer
> margin.
>
> I would like to embed this title in a box which should run from the left
> hand side of the screen to the right and be say 10 lines high. I would like
> to color the box background red, the title "MY TITLE" would appear in blue
> inside the box. This could be described as a header.  

Admittedly a hack:

opar <- par(mfrow=c(2,2),mar=c(4,4,2,2), oma = c(1, 1, 3, 1))
 plot(rnorm(100),1:100)
 plot(rnorm(100),1:100)
 plot(rnorm(100),1:100)
 plot(rnorm(100),1:100)
 par(opar)
 rect(-5, 110, 5, 120, col="red", xpd=NA)
 title("MY TITLE", outer = TRUE, cex = 1.5, adj=0, col.main="blue", font=2, adj=0.5,line=-2)

--

David Winsemius
Alameda, CA, USA

______________________________________________
[hidden email] 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.
Thanks David.

That will do nicely.

Best regards

Pete