title: Remove spacing around plotting area in r
body: <p>When I create the following plot I get unwanted space between the plotting area and the axis (i.e. the white space between the blue box and the x axis. How can I remove this space and make the plotting area flush with the plot axes? Thanks.</p>
  
  <pre><code>xleft&lt;-c(1,2,2.5)
  xright&lt;-c(2,2.5,2.75)
  ybottom&lt;-c(1,2,2.5)
  ytop&lt;-c(2,2.5,2.75)
  
  par(mar = c(15,15,2.75,2.75) + 0.1)
  plot(c(1,2.75),c(1,2.75),type="n",main="title",xlab="site.x",ylab="ylab")
  rect(xleft,ybottom,xright,ytop,col=c("blue","red","green"))
  
  #Label position along  axes
  x.label.position&lt;-(xleft+xright)/2
  y.label.position&lt;-(ybottom+ytop)/2
  
   #Labels
   x.label&lt;-c("Long species Name1","Long species Name2","Long species Name3")
   y.label&lt;-c("Long species Name4","Long species Name5","Long species Name5")
  
   text(par()$usr[1]-0.5,y.label.position,y.label,xpd=TRUE,adj=1)
   text(y=par()$usr[3]-0.5,x=x.label.position,x.label,xpd=TRUE,adj=1,srt=90)
  
   par(xpd=TRUE)
   legend(-0.1,0,legend=c("Species A","Species B","Species C"),fill=c("blue", "red", "green"))
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/oZzm3.png" alt="enter image description here"></p>
  
  <p>UPDATE
  I tried the suggestion from plannapus with my actual data but can only get the y-axis to behave is there some else in this chunk of code that is adding space to the sides of the plotting area?</p>
  
  <pre><code>quartz("colour.plot")
  par(mar=c(15,15,4,2)+0.1)#sets margins of plotting area
  
  #create the data plot
      plot(c(0,100), c(0,100), type = "n", main = paste(x,"vs",y," -",depth),xlab=paste("Species composition in remainder ",x),ylab=paste("Species composition in remainder ",y),asp=1,xaxs="i",yaxs="i")
  
  #Add the rectangles
  rect(mdf$xleft,mdf$ybottom,mdf$xright,mdf$ytop,col=mdf$colour)
  </code></pre>
  
  <p>produces</p>
  
  <p><img src="https://i.stack.imgur.com/JzzfE.png" alt="enter image description here"></p>