Thanks to visit codestin.com
Credit goes to github.com

Skip to content

backend_pdf.py fails on 3d plots (1.3.x) #1933

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
aviolov opened this issue Apr 22, 2013 · 2 comments
Closed

backend_pdf.py fails on 3d plots (1.3.x) #1933

aviolov opened this issue Apr 22, 2013 · 2 comments
Assignees

Comments

@aviolov
Copy link

aviolov commented Apr 22, 2013

Hi

I just github'd matplotlib's (1.3.x) version using git clone git://github.com/matplotlib/matplotlib.git

and I noted an issue with the backend_pdf.py script

In particular the following code
else:
##facecolors = np.array(facecolors); ##CRUDE WORKAROUND, NOT IN GITHUB SOURCE
if np.all(facecolors[:, 3] == facecolors[0, 3]):
filled = facecolors[0, 3] != 0.0
else:
can_do_optimization = False
will error since facecolors is a LIST but is treated like an NUMPY.ARRAY

The commented out code
##facecolors = np.array(facecolors);
is a crude workaround, that will fix this issue if it is uncommented at least in the code below.

The exact same problem occurs later in the script using the LIST edgecolors

in order to reproduce the bug, one can use the following script, which would throw an error about indexing lists like numpy arrays:

if name == 'main':
from pylab import *

import matplotlib
print matplotlib.__version__

from mpl_toolkits.mplot3d import Axes3D
fig = figure();
ax = fig.add_subplot(1,1, 1, projection='3d')
ax.view_init(elev = None, azim= -15)
xs = arange(3)
ts = arange(3);
X, Y = np.meshgrid(xs, ts)
Fs = X*Y;
ax.plot_surface(X, Y, Fs, cmap=cm.jet,
                        linewidth=0, antialiased=False)
savefig('testpdf.pdf')

show()
@tbekolay
Copy link
Contributor

This is fixed now. The workaround is in master, but I added a test just in case (see #2163).

@tacaswell
Copy link
Member

Closing as it has been fixed (test added: #2177) not clear when this was fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants