title: matplotlib says image is too large when it's not
body: <p>I'm doing this plotting in Jupyter Notebook:</p>
  
  <pre><code>fig = plt.figure()
  fig.suptitle("{0} nodes".format(i*4))
  print("put suptitle")
  
  fig.text(0,0,s="error: {0}".format(errors[i-1]))
  print("put text")
  
  plt.plot(means, np.zeros(means.shape), "go")
  print(means.shape)
  
  plt.plot(patterns_test, outputs, "r.", label="outputs")
  print(patterns_test.shape, outputs.shape)
  
  plt.plot(patterns_test, targets_test, "b.", label="targets")
  print(patterns_test.shape, targets_test.shape)
  
  plt.legend()
  print("legend")
  </code></pre>
  
  <p>I've printed the shape of everything that it plotted, and the values returned are:</p>
  
  <pre><code>put suptitle
  put text
  (16,)
  (62,) (62,)
  (62,) (62,)
  legend
  </code></pre>
  
  <p>Clearly nothing is large. But here's the error message:</p>
  
  <pre><code>---------------------------------------------------------------------------
  ValueError                                Traceback (most recent call last)
  /anaconda3/lib/python3.6/site-packages/IPython/core/formatters.py in __call__(self, obj)
      339                 pass
      340             else:
  --&gt; 341                 return printer(obj)
      342             # Finally look for special method names
      343             method = get_real_method(obj, self.print_method)
  
  /anaconda3/lib/python3.6/site-packages/IPython/core/pylabtools.py in &lt;lambda&gt;(fig)
      236 
      237     if 'png' in formats:
  --&gt; 238         png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', **kwargs))
      239     if 'retina' in formats or 'png2x' in formats:
      240         png_formatter.for_type(Figure, lambda fig: retina_figure(fig, **kwargs))
  
  /anaconda3/lib/python3.6/site-packages/IPython/core/pylabtools.py in print_figure(fig, fmt, bbox_inches, **kwargs)
      120 
      121     bytes_io = BytesIO()
  --&gt; 122     fig.canvas.print_figure(bytes_io, **kw)
      123     data = bytes_io.getvalue()
      124     if fmt == 'svg':
  
  /anaconda3/lib/python3.6/site-packages/matplotlib/backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, **kwargs)
     2265                 orientation=orientation,
     2266                 bbox_inches_restore=_bbox_inches_restore,
  -&gt; 2267                 **kwargs)
     2268         finally:
     2269             if bbox_inches and restore_bbox:
  
  /anaconda3/lib/python3.6/site-packages/matplotlib/backends/backend_agg.py in print_png(self, filename_or_obj, *args, **kwargs)
      505 
      506     def print_png(self, filename_or_obj, *args, **kwargs):
  --&gt; 507         FigureCanvasAgg.draw(self)
      508         renderer = self.get_renderer()
      509         original_dpi = renderer.dpi
  
  /anaconda3/lib/python3.6/site-packages/matplotlib/backends/backend_agg.py in draw(self)
      420         Draw the figure using the renderer
      421         """
  --&gt; 422         self.renderer = self.get_renderer(cleared=True)
      423         # acquire a lock on the shared font cache
      424         RendererAgg.lock.acquire()
  
  /anaconda3/lib/python3.6/site-packages/matplotlib/backends/backend_agg.py in get_renderer(self, cleared)
      442 
      443         if need_new_renderer:
  --&gt; 444             self.renderer = RendererAgg(w, h, self.figure.dpi)
      445             self._lastKey = key
      446         elif cleared:
  
  /anaconda3/lib/python3.6/site-packages/matplotlib/backends/backend_agg.py in __init__(self, width, height, dpi)
       90         self.width = width
       91         self.height = height
  ---&gt; 92         self._renderer = _RendererAgg(int(width), int(height), dpi, debug=False)
       93         self._filter_renderers = []
       94 
  
  ValueError: Image size of 298022x298 pixels is too large. It must be less than 2^16 in each direction.
  
  &lt;matplotlib.figure.Figure at 0x1c139a84a8&gt;
  </code></pre>
  
  <p>How can one sort this out?</p>