[R] Modify the plot from countCDFxt
ehlers at ucalgary.ca
Sat Oct 17 09:26:19 CEST 2009
Michelle DePrenger-Levin wrote:
> I am running the plot from countCDFxt (popbio). I would like to report the
> y-axis as a percent instead of the log scale (e^01...). I can add an axis
> with axis(2, 0:1, line =2) but I'm having trouble understanding how to assign
> the tic marks (with 'at ='). I'd like to tell it to make tics with the
> percent value (or decimal if that's my only option) at the equivalent of
> e^-1, e^-2, etc, but the values don't seem to line up correctly. I'd also
> like to replace the provided axis with my axis instead of just placing my
> axis out a line but I'm unsure how to do that.
> logNE <- log(erbr$NEast[-1]/erbr$NEast[-6])
> countCDFxt(mean(logNE), var(logNE), nt=5, Nc=1317, Ne=200)
> axis(2, 0:1, labels = c(0.018, 0.050, 0.135, 0.368, 1), at = c(0.018, 0.050,
> 0.135, 0.368, 1), line =1)
> Year NEast NWest
> 2004 731 1732
> 2005 898 2004
> 2006 714 1130
> 2007 1748 1722
> 2008 1901 1661
> 2009 1317 1563
> 1. How do I tell axis() to report as a percent?
The function countCDFxt() is unfortunately quite inflexible.
The only way to change the axis is to modify the function.
Fortunately, it's a pretty simple function. Just modify the
> 2. Why don't my values in label and at match the given axis?
Because you don't provide the correct at=...? You should be
able to just set at=c(1e-2, 1e-1, ...) as displayed on the
> 3. How do I replace the axis label in countCDFxt?
Again, the only way is to rewrite the function, perhaps
to allow additional graphics parameters like yaxt="n".
What's that '0:1' doing in your axis() call?
[Please look up the definition of "reproducible". See
bottom of this post.]
> Thanks for any help,
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help