# \donttest{
if (require(ggplot2) && require(scales)) {
set.seed(123)
df <- data.frame(
x_vals = c(0, 0.01, 0.1, 1, 10, 100, 1000, NA), # Include 0 and NA
y_vals = c(0, 10, 50, 100, 500, 1000, 2000, 50)
)
# Using pseudo_ll4_trans for the y-axis
ggplot(df, aes(x = x_vals, y = y_vals)) +
geom_point() +
scale_y_continuous(trans = pseudo_ll4_trans(lambda = 4),
name = "Y-Values (Pseudo-LL4 Scale)") +
ggtitle("Y-Axis with Pseudo-LL4 Transformation")
# Using pseudo_ll4_trans for the x-axis
ggplot(df, aes(x = x_vals, y = y_vals)) +
geom_point() +
scale_x_continuous(trans = pseudo_ll4_trans(lambda = 2), # Different lambda
name = "X-Values (Pseudo-LL4 Scale)") +
ggtitle("X-Axis with Pseudo-LL4 Transformation")
}
# }
Run the code above in your browser using DataLab