title: How to plot rectangle/bounding box in R?
body: <p>How do I generate a box rather than the hourglass shape this code is returning? I've tried changing the order of the coordinates but always have that "x" forming rather than a box, sometimes as a sideways hourglass. </p>
  
  <pre><code>library(sp)
  mybb &lt;- cbind(x=c(363498.5,480497.5,363498.5, 480497.5,363498.5), y=c(5894630,5894630,5806524,5806524,5894630))
  crs &lt;-CRS("+proj=utm +zone=12 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0")
  mybb &lt;- SpatialPolygons(list(Polygons(list(Polygon(mybb)),"1")), proj4string=crs)
  plot(mybb)
  </code></pre>
  
  <p>Returns:</p>
  
  <p><a href="https://i.stack.imgur.com/FYRHH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FYRHH.png" alt="Coordinates not plotted as a rectangle/box"></a></p>