error when plotting log'd array in matplotlib/scipy/numpy
Posted
by user248237
on Stack Overflow
See other posts from Stack Overflow
or by user248237
Published on 2010-04-22T18:26:58Z
Indexed on
2010/04/22
18:53 UTC
Read the original article
Hit count: 548
I have two arrays and I take their logs. When I do that and try to plot their scatter plot, I get this error:
File "/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/pyplot.py", line 2192, in scatter
ret = ax.scatter(x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, faceted, verts, **kwargs)
File "/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/axes.py", line 5384, in scatter
self.add_collection(collection)
File "/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/axes.py", line 1391, in add_collection
self.update_datalim(collection.get_datalim(self.transData))
File "/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/collections.py", line 153, in get_datalim
offsets = transOffset.transform_non_affine(offsets)
File "/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/transforms.py", line 1924, in transform_non_affine
self._a.transform(points))
File "/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/transforms.py", line 1420, in transform
return affine_transform(points, mtx)
ValueError: Invalid vertices array.
the code is simply:
myarray_x = log(my_array[:, 0])
myarray_y = log(my_array[:, 1])
plt.scatter(myarray_x, myarray_y)
any idea what could be causing this? thanks.
© Stack Overflow or respective owner