0

I would like to do a plot in R (using the plot function) with log scale on Y axis which shows on the y axis only the power of 10 in a style like 10, 100, 1000... Is it possible ? I do not like the solution with xant="n" or yant="n" , explained here, which suppress x-axis or y-axis, because if I use a code like:

plot(x33,y33,log = "x",xaxt="none",xlab =xlab.text ,ylab = "Signal Density (a.u.)",main=expression('Relaxation times distribution - H'[2]*'O'), las=1,cex.main=1,font.main=2,font.lab=2, cex.lab=0.9, cex.axis=0.7,type = "l",lwd=1.5, col="red",ylim = c(0,2000)) axis(1, 10^seq(0L,6L,2L),cex.axis=0.7) 

it shows me axis with 1e+00,1e+02...and I do not like this format. If I use the same code with seq() instead of 10^seq(0L,6L,2L), how can I say it to print only powers of 10 ? I know xant and yant are the straightforward solution but I do not know how to use them such that I can print 10, 100, 1000...

3
  • stackoverflow.com/questions/4699493/… Commented Dec 17, 2020 at 18:51
  • If you want fine control over the axis of a base plot, I'm not aware of any way other than suppressing the axis in the original plot() call and then specifying how you want it to appear with axis(). Can you say more about what you "do not like" about that solution? Commented Dec 17, 2020 at 18:53
  • @GregorThomas you are right. I modified the post to make what I mean clear. Commented Dec 18, 2020 at 8:31

1 Answer 1

1

This post appears to answer your question. The log scale is applied to the x axis in this example, so just change that to y axis.

Logarithmic scale plot in R

Sign up to request clarification or add additional context in comments.

2 Comments

Hi thank you but, as I wrote in the post that I have modified, I do not really like the format with 1e+00,1e+02 etc... :( I would like to say it to print 10, 100,1000...
With axis you can use the labels and at arguments to specify exactly the labels you want at the locations you want.