How do you change the starting point of your plot in R?

后端 未结 1 1229
广开言路
广开言路 2021-01-28 11:04

I want to set the starting point of my graph (both in the x- and y-axis) to be zero. I have used the xlim() and ylim() functions to no avail. I have at

相关标签:
1条回答
  • 2021-01-28 11:54

    Your axes do start at 0, and xlim and ylim are what you need to change that.

    What I think you are referring to is the spacing between the axes and the plot. There are two extra parameters that allow you to change that, xaxs and yaxs.

    plot (x, y, xlim=c(0,10), ylim=c(0,10),
          xaxs="i", yaxs="i") 
    

    This should do the trick

    See the par help for more info.

    0 讨论(0)
提交回复
热议问题