title: How to imshow with Invisible figure in MATLAB running on Linux
body: <p>My goal is to:</p>
  
  <ol>
  <li>Create an invisible figure</li>
  <li>Using subplots, plot images on it, and then</li>
  <li>Save it without having it to open.</li>
  </ol>
  
  <p>Thus, I am running the following code:</p>
  
  <pre><code>f = figure('Visible', 'off');
  subplot(2, 2, 1), imshow(image1);
  subplot(2, 2, 2), imshow(image2);
  subplot(2, 2, 3), imshow(image3);
  subplot(2, 2, 4), imshow(image4);
  saveas(f, 'filename');
  </code></pre>
  
  <p>But I get the error:</p>
  
  <pre><code>Error using imshow (line xxx)
  IMSHOW unable to display image.
  </code></pre>
  
  <p>This means that imshow is trying to display image. Is there a way to have <code>imshow</code> display image in the invisible figure and not try to pop up?</p>