[R] Help with axis labels

Gabor Grothendieck ggrothendieck at gmail.com
Wed Jun 18 19:09:17 CEST 2008


See ?axTexpr in the sfsmisc package.  There are several examples on that
page.

On Wed, Jun 18, 2008 at 12:59 PM, Tariq Perwez <tariq.perwez at gmail.com> wrote:
> Hi
> I have patched together (from various sources) the following code to get
> semi-logarithmic plot. Unfortunately, my labels come out also at
> intermediate places between 10^2, 10^3, 10^4 etc. Since I put the code
> together from various sources and do not understand fully how the code is
> working, I have not been able to get rid of the labels like 10^1.69897,
> 10^2.69897 etc. I would appreciate if someone could modify the following
> code to solve this problem for me. Regards,
>
> Tariq
>
> ## Code follows
>
>
> time <- c(0,30,60,90,120,150,180,210,240,270,300,330,360,390,410)
>
> sk3222 <- c(19,46,73,130,190,358,632,1240,2340,4666,9422,17923,39448,72809,
> 149765)
>
>
>
> plot(time,sk3222, yaxt="n",log ="y", xaxt="n", type= "o", las = 2,
> main = "Semi-logarithmic
> plot")
>
>
> axis(1, c(0,60,120,180,240,300,360,420))
>
>
>
> axis.at <- 10 ^ c(0:10)
>
> axis(2, at = 1:10 * rep(axis.at[-1] / 10, each = 10), tcl = -0.5, labels =
> FALSE)
>
>
>
> at <- axTicks(2)
>
> axis(2, c(1:200000), at=at, labels=parse(text=paste("10^",log10(at))), las=2
> )
>
>
>
> rm(list=ls())
>
>        [[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.
>



More information about the R-help mailing list