Discussion:
Backtransform Log scale
Adrián Naveda-Rodríguez
2018-08-30 14:38:14 UTC
Permalink
Hi,
I am making a regression model plot where the response variable is log
transformed. I want to plot the prediction using the original scale. I have
tried using scales_y_continuous() but it did not work.
Does any body knows how to backtransform log scale in ggplot?

Thanks, Adrian
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility

To post: email ***@googlegroups.com
To unsubscribe: email ggplot2+***@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
shep sheppard
2018-08-30 16:34:36 UTC
Permalink
Unbelievable, i was looking at this an hour ago. I will submit to anyone providing a better solution than this, but in a hurry. But, log2(x) can be transformed back by (2**x)

library(ggplot2)

data=mtcars
data$LogMPG <- log2(data$mpg)
ggplot(data, aes(x=wt, y=(2**LogMPG))) + geom_point()

# or
data$NewMpgFromLog <- 2**(data$LogMPG)
Hi,
I am making a regression model plot where the response variable is log transformed. I want to plot the prediction using the original scale. I have tried using scales_y_continuous() but it did not work.
Does any body knows how to backtransform log scale in ggplot?
Thanks, Adrian
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility <https://github.com/hadley/devtools/wiki/Reproducibility>
More options: http://groups.google.com/group/ggplot2 <http://groups.google.com/group/ggplot2>
---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
For more options, visit https://groups.google.com/d/optout <https://groups.google.com/d/optout>.
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility

To post: email ***@googlegroups.com
To unsubscribe: email ggplot2+***@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...