[R] x-axis tick marks on log scale plot

Robert Baer rbaer at atsu.edu
Fri May 20 15:06:09 CEST 2016


Very, very nice.  Thanks for sharing.


On 5/20/2016 4:21 AM, Martin Maechler wrote:
>>>>>> Brian Smith <bsmith030465 at gmail.com>
>>>>>>      on Thu, 19 May 2016 11:04:55 -0400 writes:
>      > Thanks all !!  On Thu, May 19, 2016 at 9:55 AM, Ivan
>      > Calandra <ivan.calandra at univ-reims.fr> wrote:
>
>      >> Hi,
>      >>
>      >> You can do it by first plotting your values without the
>      >> x-axis: plot(x,y,log="xy", xaxt="n")
>      >>
>      >> and then plotting the x-axis with ticks where you need to:
>      >> axis(side=1, at=seq(2000,8000,1000))
>
> Getting nicer looking axis ticks  for log-scale axes (and
> traditional graphics) I have created the function
>     eaxis()
> and utility function    pretty10exp(.)
>
> and I also created standard R's  axTicks(.)  to help with these.
>
>      if(!require("sfsmisc")) install.packages("sfsmisc")
>      require("sfsmisc")
>
>      x <- lseq(1e-10, 0.1, length = 201)
>      plot(x, pt(x, df=3), type = "l", xaxt = "n", log = "x")
>      eaxis(1)
>
> gives the attached plot
>
>
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.


	[[alternative HTML version deleted]]



More information about the R-help mailing list