Does a line stay straight when both axes are logged?

108 Views Asked by At

If I have a plot of a straight line with some angle. Considering just the parts of the line where $x \geq 1$ and $y \geq 1$.

If I $log$ both the $x$ and $y$ axes:

  1. Will it still be a straight line?
  2. Will it have the same slope?

For example, here is the line $y = 0.5 x$ line

When I $log$ both the $x$ and $y$ axes, I get what looks like a line with the same angle. log_line

How would I prove/disprove it is always a straight line with the same slope?

Here is the R code I used to generate the example plots.

library('ggplot2')
df <- data.frame(x = seq_len(100))
df$y <- 0.5 * df$x
p <- ggplot(df, aes(x, y)) + geom_line()
p2 <- p + scale_x_log10() + scale_y_log10()

p
p2
2

There are 2 best solutions below

1
On BEST ANSWER

Okay, so we are mapping an $x-y$ plane to $w-v$ plane where $w = \log x$ and $v = \log y$.

So what happens to the line $y = mx+b$

So the point $w$ on the $w$ axis represents $x = 10^2$. And we need $v$ to be then point that is $v= \log y =\log (m 10^w + b)$ which is not a line if $b \ne 0$..

But if $b = 0$ then $v = \log(m 10^w) = w + \log m$ will be a line.

It will have slope $1$ and $v$ intercept that corresponds to the log of the slope of the original line... which has to be positive....

And we can only translate the parts of the line where $x$ and $y = mx+b$ are both positive.

0
On

Imagine we have a line with $log-log$ axes. It will look like below:

$log(y)=alog(x)+b \to log(y)=alog(x)+log(e^b)=log(x^a)+log(e^b)=log(x^ae^b)$

$\to log(y)=log(x^ae^b)\to y=x^ae^b$

As you can see if you are supposing a line in $log-log$ axes, it will be like power rule in $x-y$ axes, except when $a=1$ or $a=0$.

If $a=1$, then the degree of the line may vary from $tan^{-1}(e^b)$ in $x-y$ axes to $tan^{-1}(a)|_{a=1}=\pi/4$. If also $b=1$ then the angle wont change.

If $a=0$, then in both group of axes we have $y=...$ so the angle will remain unchanged.