# Re: [R] Help with axis labels

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Wed, 18 Jun 2008 13:09:17 -0400

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.
>

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. Received on Wed 18 Jun 2008 - 17:13:28 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 18 Jun 2008 - 17:30:44 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.