Add axis tick-marks on top and to the right to a ggplot?

后端 未结 3 708
轮回少年
轮回少年 2020-12-03 08:50

In base graphics we can easily add tick-marks at different sides of the plot by using axis and the side argument:

par         


        
3条回答
  •  遥遥无期
    2020-12-03 09:30

    This doesn't solve the discrete issue, but the secondary axis need not be a duplication of the primary axis. So on "side=4" I can put a transformation of the "side=2" axis.

    See more here: https://ggplot2.tidyverse.org/reference/sec_axis.html

    e.g., scale_y_continuous(sec.axis = sec_axis(~ . + 10))

提交回复
热议问题