Two things:
- you need to un-
log transform the y1 data, since ggplot assumes all data needs to be transformed; and
- you need to map the new variable names
Starting with your original plot unchanged (but assigned to gg):
gg <- tibble(
x = seq(1, 10, .01),
y = sin(log(x)*pi) + 2
) %>%
ggplot(aes(x,y)) +
geom_line() +
scale_x_continuous(trans = log_trans()) +
scale_y_continuous(trans = log_trans())
# fixing log(x) -> log(x1)
newdata <- tibble(
x1 = seq(2, 11, .01),
y1 = sin(log(x1)*pi) + 2
)
We can plot with:
gg +
geom_line(aes(x = x1),
data = mutate(newdata, y = exp(y1)), color = "red")

FYI, unless you need scale_*_continuous for other reasons, I think scale_*_log10() presents better looking default ticks.
gg <- tibble(
x = seq(1, 10, .01),
y = sin(log(x)*pi) + 2
) %>%
ggplot(aes(x,y)) +
geom_line() +
scale_x_log10() +
scale_y_log10()
gg +
geom_line(aes(x = x1), data = mutate(newdata, y = exp(y1)), color = "red")

Another alternative (not sure what you're going for) is more generic and completely ancillary to the log-axis issue: we assign data=, but because the original aesthetics x and y are not both present, we need to map them explicitly.
gg +
geom_line(aes(x = x1, y = y1), data = newdata, color = "red")

log(x)tolog(x1)