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

Ivan Calandra ivan.calandra at univ-reims.fr
Thu May 19 15:55:29 CEST 2016


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

HTH,
Ivan

--
Ivan Calandra, PhD
Scientific Mediator
University of Reims Champagne-Ardenne
GEGENAA - EA 3795
CREA - 2 esplanade Roland Garros
51100 Reims, France
+33(0)3 26 77 36 89
ivan.calandra at univ-reims.fr
--
https://www.researchgate.net/profile/Ivan_Calandra
https://publons.com/author/705639/

Le 19/05/2016 à 15:40, Brian Smith a écrit :
> Hi,
>
> I have a plot with log scale on the axes. How do I add ticks and labels in
> addition to the ones provided by default? Can I specify where I want the
> ticks and labels?
>
> For example:
>
> set.seed(12345)
> x <- sample(1:10000,10)
> y <- sample(1:10000,10)
>
> plot(x,y,log="xy")
>
>
> For me, this plot has tick marks (and labels) at 2000, 4000, 6000, 8000.
> How can I make the axes so that it has marks and labels at 1000 intervals
> (i.e. 2000, 3000, 4000, etc.)
>
> thanks!
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>



More information about the R-help mailing list