Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在 ggplot2 的轴刻度上显示两个替代单位(如果有的话)?我想要实现的是这样的:
这是一个 hacky 方法:
d = data.frame(x = 1:20, y = rnorm(20, 5, 5)) ggplot(data = d, aes(x = x, y = y)) + scale_x_continuous(breaks = c(1:20, seq(2.54, 20, 2.54)), labels = c(1:20, paste0("\n", 1:as.integer(20/2.54), "\""))) + geom_point()