Center x and y axis with ggplot2

后端 未结 4 856
一整个雨季
一整个雨季 2020-11-29 10:29

Is there a way to get the axes, with labels in the center of a ggplot2 plot, like a traditional graphing calculator? I\'ve looked through the docs and there doesn\'t seem to

4条回答
  •  执笔经年
    2020-11-29 10:55

    I would just use xlim and ylim.

    dat = data.frame(x = 1, y =1)
    p = ggplot(data = dat, aes(x=x, y=y)) + 
       geom_point(size = 5) + 
       xlim(-2, 2) + 
       ylim(-2, 2)
    p
    

    screenshot

提交回复
热议问题