CafféSospeso
CafféSospeso

Reputation: 1188

log="y" convert only y-axis label or also y-coordinates of my data?

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

Upvotes: 0

Views: 2342

Answers (1)

Anders Ellern Bilgrau
Anders Ellern Bilgrau

Reputation: 10263

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.

Upvotes: 1

Related Questions