|
|
Hey everyone,
I'm working on a contour plot depicting asymptomatic prevalence at varying durations of infectiousness and force of infection. I've been able to work everything out except for this one - my legend title keeps getting cut off. Here's what I have:
filled.contour(x=seq(2,30,length.out=nrow(asym_matrix)),
y=seq(1,2,length.out=ncol(asym_matrix)),
asym_matrix,
color = function(x)rev(heat.colors(x)),
plot.title = title(main="Asymptomatic Prevalence in 0-4 Year Olds with\n Increasing Duration of Infectiousness",
xlab = "Duration of Infectiousness",
ylab = "Relative Force of Infection"),
key.title = title(main = "Asymptomatic\n Prevalence"))
My first thought was to make the legend title text smaller using cex = 0.75 (or similar), but it doesn't change the text size at all. In fact, none of the modifiers that I've tried to add to the key.title line (size, color, font, etc) seems to be making a bit of difference.
key.title = title(main = "Asymptomatic\n Prevalence", cex = "0.75")
I assume there's an override earlier in the code, but I have no idea what it is. Any suggestions?
Thanks!
Kirsten
|
|
On Oct 3, 2012, at 12:58 PM, Kirsten wrote:
> Hey everyone,
>
> I'm working on a contour plot depicting asymptomatic prevalence at varying
> durations of infectiousness and force of infection. I've been able to work
> everything out except for this one - my legend title keeps getting cut off.
> Here's what I have:
>
> filled.contour(x=seq(2,30,length.out=nrow(asym_matrix)),
> y=seq(1,2,length.out=ncol(asym_matrix)),
Error in nrow(asym_matrix) : object 'asym_matrix' not found
>
> asym_matrix,
> color = function(x)rev(heat.colors(x)),
> plot.title = title(main="Asymptomatic Prevalence in 0-4 Year Olds with\n
> Increasing Duration of Infectiousness",
> xlab = "Duration of Infectiousness",
> ylab = "Relative Force of Infection"),
> key.title = title(main = "Asymptomatic\n Prevalence"))
>
> My first thought was to make the legend title text smaller using cex = 0.75
> (or similar), but it doesn't change the text size at all. In fact, none of
> the modifiers that I've tried to add to the key.title line (size, color,
> font, etc) seems to be making a bit of difference.
>
> key.title = title(main = "Asymptomatic\n Prevalence", cex = "0.75")
>
> I assume there's an override earlier in the code, but I have no idea what it
> is. Any suggestions?
>
> Thanks!
>
> Kirsten
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Legend-Truncated-Using-filled-contour-tp4644938.html> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [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.
David Winsemius, MD
Alameda, CA, USA
______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
|
|
Data attached - didn't realize I could do that last night. Here's the data
inport piece of my code, change the pathname to your computer.
asym<-read.csv('/Users/kirstensimmons/Desktop/Asym04.csv')
asym
#put the data into a data matrix
asym_matrix<-data.matrix(asym)
On Thu, Oct 4, 2012 at 6:35 AM, David Winsemius < [hidden email]>wrote:
>
> On Oct 3, 2012, at 12:58 PM, Kirsten wrote:
>
> > Hey everyone,
> >
> > I'm working on a contour plot depicting asymptomatic prevalence at
> varying
> > durations of infectiousness and force of infection. I've been able to
> work
> > everything out except for this one - my legend title keeps getting cut
> off.
> > Here's what I have:
> >
> > filled.contour(x=seq(2,30,length.out=nrow(asym_matrix)),
> > y=seq(1,2,length.out=ncol(asym_matrix)),
>
>
> Error in nrow(asym_matrix) : object 'asym_matrix' not found
> >
>
>
>
> > asym_matrix,
> > color = function(x)rev(heat.colors(x)),
> > plot.title = title(main="Asymptomatic Prevalence in 0-4 Year Olds with\n
> > Increasing Duration of Infectiousness",
> > xlab = "Duration of Infectiousness",
> > ylab = "Relative Force of Infection"),
> > key.title = title(main = "Asymptomatic\n Prevalence"))
> >
> > My first thought was to make the legend title text smaller using cex =
> 0.75
> > (or similar), but it doesn't change the text size at all. In fact, none
> of
> > the modifiers that I've tried to add to the key.title line (size, color,
> > font, etc) seems to be making a bit of difference.
> >
> > key.title = title(main = "Asymptomatic\n Prevalence", cex = "0.75")
> >
> > I assume there's an override earlier in the code, but I have no idea
> what it
> > is. Any suggestions?
> >
> > Thanks!
> >
> > Kirsten
> >
> >
> >
> > --
> > View this message in context:
> http://r.789695.n4.nabble.com/Legend-Truncated-Using-filled-contour-tp4644938.html> > Sent from the R help mailing list archive at Nabble.com.
> >
> > ______________________________________________
> > [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.
>
> David Winsemius, MD
> Alameda, CA, USA
>
>
--
Kirsten Simmons, MPH
Polymath interested in productivity, how ideas spread, gardening,
marketing, entrepreneurship and models of social networks and disease
transmission
______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
|
|
On Oct 3, 2012, at 12:58 PM, Kirsten wrote:
> Hey everyone,
>
> I'm working on a contour plot depicting asymptomatic prevalence at varying
> durations of infectiousness and force of infection. I've been able to work
> everything out except for this one - my legend title keeps getting cut off.
> Here's what I have:
>
> filled.contour(x=seq(2,30,length.out=nrow(asym_matrix)),
> y=seq(1,2,length.out=ncol(asym_matrix)),
> asym_matrix,
> color = function(x)rev(heat.colors(x)),
> plot.title = title(main="Asymptomatic Prevalence in 0-4 Year Olds with\n
> Increasing Duration of Infectiousness",
> xlab = "Duration of Infectiousness",
> ylab = "Relative Force of Infection"),
> key.title = title(main = "Asymptomatic\n Prevalence"))
>
> My first thought was to make the legend title text smaller using cex = 0.75
> (or similar), but it doesn't change the text size at all. In fact, none of
> the modifiers that I've tried to add to the key.title line (size, color,
> font, etc) seems to be making a bit of difference.
>
> key.title = title(main = "Asymptomatic\n Prevalence", cex = "0.75")
I couldn't see it until now (that I got your csv file) but you should not be qusoting the cex parameter. Also it should be `cex.main` rather than just `cex`. As explained in the filled.contour help page (which you clearly have read) the legend is really a second plot and you should be using the title function(as you clearly have figured out.) But the details and examples are in ?title .
Try:
...,
key.title = title(main = "Asymptomatic\n Prevalence", cex.main=0.70) )
# 0.75 still got cut off a bit. =, and I think we are both on Macs so this should be the same on a default quartz() window.
>
> I assume there's an override earlier in the code, but I have no idea what it
> is. Any suggestions?
People who choose to go to Nabble , a distinctly smaller group, would have been able to find you data, but most people could not. You should have used a .txt extension so you mailer would not improperly label it as something other than MIME-text. Or you could have simply copied the output of dput() into your email.
--
David Winsemius, MD
Alameda, CA, USA
______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
|
|
This worked perfectly, thank you!
(Sorry for the delay, was traveling and didn't get a chance to test it until now.)
Kirsten
On Oct 4, 2012, at 1:30 PM, David Winsemius < [hidden email]> wrote:
>
> On Oct 3, 2012, at 12:58 PM, Kirsten wrote:
>
>> Hey everyone,
>>
>> I'm working on a contour plot depicting asymptomatic prevalence at varying
>> durations of infectiousness and force of infection. I've been able to work
>> everything out except for this one - my legend title keeps getting cut off.
>> Here's what I have:
>>
>> filled.contour(x=seq(2,30,length.out=nrow(asym_matrix)),
>> y=seq(1,2,length.out=ncol(asym_matrix)),
>> asym_matrix,
>> color = function(x)rev(heat.colors(x)),
>> plot.title = title(main="Asymptomatic Prevalence in 0-4 Year Olds with\n
>> Increasing Duration of Infectiousness",
>> xlab = "Duration of Infectiousness",
>> ylab = "Relative Force of Infection"),
>> key.title = title(main = "Asymptomatic\n Prevalence"))
>>
>> My first thought was to make the legend title text smaller using cex = 0.75
>> (or similar), but it doesn't change the text size at all. In fact, none of
>> the modifiers that I've tried to add to the key.title line (size, color,
>> font, etc) seems to be making a bit of difference.
>>
>> key.title = title(main = "Asymptomatic\n Prevalence", cex = "0.75")
>
> I couldn't see it until now (that I got your csv file) but you should not be qusoting the cex parameter. Also it should be `cex.main` rather than just `cex`. As explained in the filled.contour help page (which you clearly have read) the legend is really a second plot and you should be using the title function(as you clearly have figured out.) But the details and examples are in ?title .
>
> Try:
> ...,
> key.title = title(main = "Asymptomatic\n Prevalence", cex.main=0.70) )
>
> # 0.75 still got cut off a bit. =, and I think we are both on Macs so this should be the same on a default quartz() window.
>
>>
>> I assume there's an override earlier in the code, but I have no idea what it
>> is. Any suggestions?
>
> People who choose to go to Nabble , a distinctly smaller group, would have been able to find you data, but most people could not. You should have used a .txt extension so you mailer would not improperly label it as something other than MIME-text. Or you could have simply copied the output of dput() into your email.
>
> --
>
> David Winsemius, MD
> Alameda, CA, USA
>
______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
|
|