title: Matplotlib.animation: how to remove white margin
body: <p>I try to generate a movie using the matplotlib movie writer. If I do that, I always get a white margin around the video. Has anyone an idea how to remove that margin? </p>
  
  <p>Adjusted example from <a href="http://matplotlib.org/examples/animation/moviewriter.html" rel="noreferrer">http://matplotlib.org/examples/animation/moviewriter.html</a></p>
  
  <pre><code># This example uses a MovieWriter directly to grab individual frames and
  # write them to a file. This avoids any event loop integration, but has
  # the advantage of working with even the Agg backend. This is not recommended
  # for use in an interactive setting.
  # -*- noplot -*-
  
  import numpy as np
  import matplotlib
  matplotlib.use("Agg")
  import matplotlib.pyplot as plt
  import matplotlib.animation as manimation
  
  FFMpegWriter = manimation.writers['ffmpeg']
  metadata = dict(title='Movie Test', artist='Matplotlib',
          comment='Movie support!')
  writer = FFMpegWriter(fps=15, metadata=metadata, extra_args=['-vcodec', 'libx264'])
  
  fig = plt.figure()
  ax = plt.subplot(111)
  plt.axis('off')
  fig.subplots_adjust(left=None, bottom=None, right=None, wspace=None, hspace=None)
  ax.set_frame_on(False)
  ax.set_xticks([])
  ax.set_yticks([])
  plt.axis('off')
  
  with writer.saving(fig, "writer_test.mp4", 100):
      for i in range(100):
          mat = np.random.random((100,100))
          ax.imshow(mat,interpolation='nearest')
          writer.grab_frame()
  </code></pre>