title: How to remove image margins when plotting and exporting square image with R?
body: <p>I'm trying to plot a square TIFF image (1024 x 1024), but it displays it as a vertically stretched rectangle. I've tried adjusting margins in <code>plotRGB</code> and utilizing <code>par(mar=c(0,0,0,0))</code>, but I can't get the plot and output to be a square even though R recognizes the raster as a square.</p>
  <p>Does anyone have any advice on how to simply fix this issue? I've attached two images, one of the original image and one of the image when plotted/exported in R. The goal of my program is to use <code>histmatch</code> solely to adjust the saturation of the source image to that of a matching reference image. The exported image thus cannot be vertically stretched, and must have no margin.</p>
  <p><a href="https://i.stack.imgur.com/4fRhr.jpg" rel="nofollow noreferrer">Screenshot of original image</a></p>
  <p><a href="https://i.stack.imgur.com/lT8L9.jpg" rel="nofollow noreferrer">R display and export of image</a></p>