title: Write to a file the bar plot of imhist matlab
body: <p>I want to save the <code>imhist</code> plot to a file.</p>
  
  <p>To save an image I use the <code>imwrite</code> function. To display its histogram, I use:</p>
  
  <pre><code>figure, bar(imhist(scene));
  </code></pre>
  
  <p>How do I save the resulting image to a file with <code>imwrite</code>?</p>
  
  <p>Here is a sample plot generated by the <code>bar</code> function:</p>
  
  <p><img src="https://i.stack.imgur.com/isx17.png" alt="enter image description here"></p>
  
  <p>Thanks.</p>