Reputation: 2945
I am trying to use coord_trans()
to transform the coordinate of my figure to log10, but I get an esoteric error.
Code:
library(gapminder)
library(ggplot2)
ggplot(data = gapminder,
mapping = aes(x = year,
y = gdpPercap * pop)) +
geom_smooth(method = "lm") +
coord_trans(y = "log10")
Error:
Error in if (zero_range(range)) zero_width else diff(range) : missing value where TRUE/FALSE needed In addition: Warning message: In trans$transform(limits) : NaNs produced
Upvotes: 0
Views: 749
Reputation: 5898
If you are looking for a solution to plot it, try
library(gapminder)
library(ggplot2)
ggplot(data = gapminder,
mapping = aes(x = year,
y = log10(gdpPercap * pop))) +
geom_smooth(method = "lm")
Upvotes: 1