0

I'm building a plot in R and I have used the plot() function, with log="y" parameter. Does that mean that ONLY the y-axis labels will be converted in log scale OR that also the y-coordinates of my data will be converted in log-scale?

Thank you

Anders Ellern Bilgrau
  • 9,928
  • 1
  • 30
  • 37
CafféSospeso
  • 1,101
  • 3
  • 11
  • 28
  • 1
    It's not entirely clear (to me) what you're asking. Please add a reproducible example and formulate a precise question. See http://stackoverflow.com/q/5963269 for hints at how to ask a great R question – BenBarnes Apr 30 '15 at 14:30

1 Answers1

1

When using log = "y" it plots the log-transformed y-values with the labels on the original scale -- the opposite of what you seem to suggest.

Compare these three plots:

x <- rnorm(50)
y <- 2*exp(x) + rexp(50)

plot(x, y)            # y-scale,     y-scale-labels
plot(x, y, log = "y") # log-y-scale, y-scale-labels
plot(x, log(y))       # log-y-scale, log-y-scale labels

Notice that the last two plots only differs in the y-axis labels. Both are still correct as the axis titles are also different.

Anders Ellern Bilgrau
  • 9,928
  • 1
  • 30
  • 37
  • This is exactly what I mean. I would like to know what you think, but I guess that if i use log scale for my data, it doesn't make sense use y-scale label. no? or may be is it good if I want to see the data in a clearer way, but keeping the original scale of my y-values. – CafféSospeso Apr 30 '15 at 15:03
  • @user29859 It's perfectly fine to plot on a log-y-scale but keep the labels on the original scale (`log = "x"`). I prefer it, unless there's a good reason not to do it. Then readers don't have to mentally compute `exp(label)` to read the plot. – Anders Ellern Bilgrau Apr 30 '15 at 15:06
  • Yes, I agree with as I edited my previous comment. It is good if I want to see the data in a clearer way (log-scale), but keeping the original scale of my y-values. – CafféSospeso Apr 30 '15 at 15:09
  • 1
    Sorry, I have a second question linked to that. The log="" is a logarithm base 10? – CafféSospeso Apr 30 '15 at 15:55