Re: [Matplotlib-users] Save pdf with plot_surface

2013-04-21 Thread Michael Droettboom
Just curious -- where is the formula for matplotlib in homebrew?  I 
can't find it.  I thought I would look into why that was failing -- it 
may just be simply that it's an old version of matplotlib and this bug 
is now fixed in the latest release.


Mike

On 04/20/2013 11:12 PM, Derek Thomas wrote:
I was able to fix this by uninstalling the matplotlib from homebrew 
and installing with pip.



On Sat, Apr 20, 2013 at 9:33 AM, Derek Thomas derekctho...@gmail.com 
mailto:derekctho...@gmail.com wrote:


This may be known, but the following modified example from
http://matplotlib.org/mpl_toolkits/mplot3d/tutorial.html fails
with a TypeError at matplotlib/backends/backend_pdf.pyc in
draw_path_collection.  Is it possible to save pdf files with
surface plots?

from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from matplotlib.ticker import LinearLocator, FormatStrFormatter
import matplotlib.pyplot as plt
import numpy as np

fig = plt.figure()
ax = fig.gca(projection='3d')
X = np.arange(-5, 5, 0.25)
Y = np.arange(-5, 5, 0.25)
X, Y = np.meshgrid(X, Y)
R = np.sqrt(X**2 + Y**2)
Z = np.sin(R)
surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1,
cmap=cm.coolwarm,
linewidth=0, antialiased=False)
ax.set_zlim(-1.01, 1.01)

ax.zaxis.set_major_locator(LinearLocator(10))
ax.zaxis.set_major_formatter(FormatStrFormatter('%.02f'))

fig.colorbar(surf, shrink=0.5, aspect=5)
fig.savefig('test.pdf')
plt.show()




--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis  visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter


___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis  visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] help, installing matplotlib on mac 10.8

2013-04-21 Thread Paul Ivanov
Hi Charles,

I'm sending my reply to the matplotlib-users list - please follow
up there, so that others benefit from your experience, or folks
who have run into the same issue can also pitch in with their
help. 

Here's where to go to sign up: 
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Once you're signed up, you hit reply all to this email (it
would be kind of you to remove my name from the addressee list
when you do that, so that the email goes only to the
matplotlib-users list, of which I'm a member)

See the rest of my reply below your original message.

cnyaig...@gmail.com, on 2013-04-21 09:43,  wrote:
 Hello Paul
 
 I wished to use matplotlip, but I am facing diffuculties and I
 was wondering if you can help.
 
 Matplot lib is installed but pylab has the following error. I
 will appreciate a suggestion if you have some please
 
 Charles
 
 
 
  import numpy as np
  import pylab as pl
 Traceback (most recent call last):
   File stdin, line 1, in module
   File 
 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pylab.py,
  line 1, in module
 from matplotlib.pylab import *
   File 
 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/pylab.py,
  line 222, in module
 from matplotlib import mpl  # pulls in most modules
   File 
 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/mpl.py,
  line 1, in module
 from matplotlib import artist
   File 
 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/artist.py,
  line 7, in module
 from transforms import Bbox, IdentityTransform, TransformedBbox, \
   File 
 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/transforms.py,
  line 35, in module
 from matplotlib._path import (affine_transform, 
 count_bboxes_overlapping_bbox,
 ImportError: 
 dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/_path.so,
  2): no suitable image found.  Did find:
   
 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/_path.so:
  no matching architecture in universal wrapper

This looks like conflicting versions of python are being used (64
bit and 32 bit). One trick for getting to the bottom of Python
stack traces is to take the text of the *last* line of the
traceback, remove all but the last few bits of the file path
(since other folks won't necessarily be installing to the extact
path you've installeed to), and feed it to google. 

The first google hit for _path.so: no matching architecture in
universal wrapper is this stackoverflow post:
http://stackoverflow.com/questions/5419439/matplotlib-pyplot-on-os-x-with-64-bit-python-from-python-org

See if the solution suggested there (installing 32-bit version
from python.org)

best,
-- 
Paul Ivanov
314 address only used for lists,  off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 

--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis  visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users