I used my own data to simulate what you wanted. You should just need the last two lines of code.
library(ggplot2)
library(tidyverse)
set.seed(55)
scatter_data <- tibble(x_var = runif(100, min = 0, max = 25)
,y_var = log2(x_var) + rnorm(100)
)
p <- ggplot(data = scatter_data, aes(x = x_var, y = y_var)) +
geom_point()
p + scale_x_reverse(lim =c(25,0)) +
scale_y_continuous(position = "right")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.