示出了两个测量单元上轴GGPLOT2蜱(Show two measurement units on

2019-07-21 02:42发布

它是如何可能的(如果有的话),以显示两个可供选择的单位上轴GGPLOT2蜱? 我想实现的是这样的:

Answer 1:

下面是这样做的哈克的方式:

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()



文章来源: Show two measurement units on axis ticks in ggplot2