Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I remove plot margins between the axes of the plot and the plot contents in R?

Tags:

plot

r

I want to remove the space between the axes of the plot and the plot contents themselves. Any ideas?

like image 684
Dan Avatar asked Sep 05 '09 02:09

Dan


1 Answers

Look at the parameters xaxs and yaxs (under ?par). By default the axis contains the data range plus 4% on either side. If you override the parameter, then you can get an axis exactly equal to the data range. Cf:

> curve(x^2)

> curve(x^2, xaxs="i", yaxs="i")
like image 193
Jonathan Chang Avatar answered Nov 10 '22 17:11

Jonathan Chang