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

Skip to content

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

Closed
@aviolov

Description

@aviolov

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()

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions