Closed
Description
Minimal example:
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
N = 100
x = np.arange(N)
plt.scatter(x, x+ np.random.randn(N), label = "tips")
plt.legend()
ax = plt.gca()
# Locate the legend to the optimal position (automatic location does not work)
legend = ax.get_legend()
labels = (x.get_text() for x in legend.get_texts())
ax.legend(legend.legendHandles, labels, loc='lower right')
# Reset parameters
plt.matplotlib.rcParams.update(plt.matplotlib.rcParamsDefault)
# Plot again
plt.plot([0,1], [0,1])
Produces error:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/usr/local/lib/python3.4/dist-packages/IPython/core/formatters.py in __call__(self, obj)
335 pass
336 else:
--> 337 return printer(obj)
338 # Finally look for special method names
339 method = _safe_get_formatter_method(obj, self.print_method)
/usr/local/lib/python3.4/dist-packages/IPython/core/pylabtools.py in <lambda>(fig)
205
206 if 'png' in formats:
--> 207 png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', **kwargs))
208 if 'retina' in formats or 'png2x' in formats:
209 png_formatter.for_type(Figure, lambda fig: retina_figure(fig, **kwargs))
/usr/local/lib/python3.4/dist-packages/IPython/core/pylabtools.py in print_figure(fig, fmt, bbox_inches, **kwargs)
115
116 bytes_io = BytesIO()
--> 117 fig.canvas.print_figure(bytes_io, **kw)
118 data = bytes_io.getvalue()
119 if fmt == 'svg':
/usr/local/lib/python3.4/dist-packages/matplotlib/backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, **kwargs)
2149 origedgecolor = self.figure.get_edgecolor()
2150
-> 2151 self.figure.dpi = dpi
2152 self.figure.set_facecolor(facecolor)
2153 self.figure.set_edgecolor(edgecolor)
/usr/local/lib/python3.4/dist-packages/matplotlib/figure.py in _set_dpi(self, dpi)
409 def _set_dpi(self, dpi):
410 self._dpi = dpi
--> 411 self.dpi_scale_trans.clear().scale(dpi, dpi)
412 self.callbacks.process('dpi_changed', self)
413 dpi = property(_get_dpi, _set_dpi)
/usr/local/lib/python3.4/dist-packages/matplotlib/transforms.py in scale(self, sx, sy)
1993 scale_mtx = np.array(
1994 [[sx, 0.0, 0.0], [0.0, sy, 0.0], [0.0, 0.0, 1.0]],
-> 1995 np.float_)
1996 self._mtx = np.dot(scale_mtx, self._mtx)
1997 self.invalidate()
ValueError: could not convert string to float: 'figure'
<matplotlib.figure.Figure at 0x7fc0f80c3860>
- Matplotlib version, Python version and Platform (Windows, OSX, Linux ...)
{'dirty': False,
'error': None,
'full-revisionid': 'c0728d23ca5adbff6b79cda3153d0d36bff12c55',
'version': '1.5.1+1304.gc0728d2'}
Python 3.4
Ubuntu 14
- How did you install Matplotlib and Python (pip, anaconda, from source ...)
pip3 github