FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Lists not supported by Axes3D.plot_surface · Issue #181 · matplotlib/matplotlib · GitHub

Repository navigation

Lists not supported by Axes3D.plot_surface #181

Closed

Description

Original report at SourceForge, opened Thu Dec 16 09:18:48 2010

Lists are not not supported by Axes3D.plot_surface although they are with 2D plots.

The following doesn't work with matplotlib 1.0.0:

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

x = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5]
y = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3]
z = [3.09765624, 3.09923861, 3.07380428, 3.03930954, 3.01244428,
3.04109599, 3.06855951, 3.08104518, 3.01577574, 3.02221153,
3.06242075, 3.05325844, 3.03908932, 3.06565395, 3.07982723]

fig = plt.figure()
ax = Axes3D(fig)

plot once for the colors, once for the lines

ax.plot_surface(x, y, z, rstride=1, cstride=1)
ax.set_xlabel(u'X')
ax.set_ylabel(u'Y')
ax.set_zlabel(u'Z')
plt.show()

plt.close(fig)

If you try
plt.plot(x,y), it works.

Traceback (most recent call last):
File "C:\Program Files\eclipse\plugins\org.python.pydev.debug_1.6.3.2010100513\pysrc\pydevd.py", line 1145, in
debugger.run(setup['file'], None, None)
File "C:\Program Files\eclipse\plugins\org.python.pydev.debug_1.6.3.2010100513\pysrc\pydevd.py", line 916, in run
execfile(file, globals, locals) #execute the script
File "C:\Users\user\Workspace\general\bug_list.py", line 13, in
ax.plot_surface(x, y, z, rstride=1, cstride=1)
File "C:\Python26\lib\site-packages\mpl_toolkits\mplot3d\axes3d.py", line 663, in plot_surface
rows, cols = Z.shape
AttributeError: 'list' object has no attribute 'shape'

Axes3D.plot_wireframe also doesn't work, but Axes3D.plot works.

Activity

  1. WeatherGod commented on Jun 21, 2011

    Member

    Note, plot_surface and plot_wireframe should be doing a np.asanyarray() to the inputs, but the given code should still fail anyway because they are one dimensional and does not parametrically describe a surface.

  2. added a commit that references this issue on Jul 10, 2011
    9bb3520
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL