且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何更改 ggplot2 中 x 和 y 轴的位置

更新时间:2023-11-26 13:22:52

From ggplot 2.2.0 you can set the position of the axes with the position argument in scale_:

ggplot(mpg, aes(displ, hwy)) + 
  geom_point() + 
  scale_x_continuous(position = "top") + 
  scale_y_continuous(position = "right")