You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
axes3d.py error when using lines3d and surface3d demos #3898
Hi, I recently grabbed the 1.5.x version of matplotlib from github and get some errors when using the 3d plotting demos on the matplotlib website. See below for an output. I am running python 2.7.8_2 from homebrew. I get the same error for both demo scripts. Has something changed in 1.5.x such that the demos are calling things differently?
The plotting window appears but shows nothing inside, accept for a line along the x axis at z=0. See image attached.
This might be related to a recent change. Thoughts, @mdboom?
On Sun, Dec 7, 2014 at 5:57 AM, James McCormac [email protected]
wrote:
Hi, I recently grabbed the 1.5.x version of matplotlib from github and get
some errors when using the 3d plotting demos on the matplotlib website. See
below for an output. I am running python 2.7.8_2 from homebrew. I get the
same error for both demo scripts.
Has something changed in 1.5.x such that the demos are calling things
differently?
Cheers
James
James@Jamess-MBP> python -i lines3d_demo.py
Traceback (most recent call last):
File
"/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib-1.5.x-py2.7-macosx-10.10-x86_64.egg/matplotlib/artist.py",
line 59, in draw_wrapper
draw(artist, renderer, _args, *_kwargs)
File
"/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib-1.5.x-py2.7-macosx-10.10-x86_64.egg/matplotlib/figure.py",
line 1090, in draw
func(*args)
File
"/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.py",
line 273, in draw
ax.draw(renderer)
File
"/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mpl_toolkits/mplot3d/axis3d.py",
line 264, in draw
self.axes.transAxes.transform(peparray[0:2, 0]))
ValueError: Expected 2-dimensional array, got 1
—
Reply to this email directly or view it on GitHub #3898.
I got the a problem which is similar. On Mac OSX10.10.2, brew python 2.7.9 and installing matplotlib with pip. When I plotting 3d, I got the problem.
#--------------- plot3d function define in file plotData.py-----------------#defplot3d(x,y,J):
fig=plt.figure(2)
ax=Ax3(fig)
ax.plot_surface(x,y,J,rstride=5,cstride=5,cmap=cm.summer_r)
plt.show()
#-------------- call the plot3d() and plot the 3d figure ------------------# print('Visualizing J(theta_0, theta_1) ...\n')
theta_0=np.array([np.linspace(-10,10,num=100)])
theta_1=np.array([np.linspace(-1,4,num=100)])
J_theta=np.array(np.empty((100,100)))
foriinrange(100):
forjinrange(100):
J_theta[i,j] =compC(x,y,[[theta_0[0,i]],[theta_1[0,j]]])
fromplotDataimportplot3dplot3d(theta_0,theta_1.T,J_theta)
#------------ end of the code ------------#
My 3d-figure can be plotted. There is a warning that upset me for my cursor put into the plotting area it will occur.
I got the a problem which is similar. On Mac OSX10.10.2, brew python 2.7.9
and installing matplotlib with pip. When I plotting 3d, I got the problem.
#--------------- plot3d function define in file plotData.py-----------------#
def plot3d(x,y,J):
fig = plt.figure(2)
ax = Ax3(fig)
ax.plot_surface(x,y,J,rstride=5,cstride=5,cmap=cm.summer_r)
plt.show()#-------------- call the plot3d() and plot the 3d figure ------------------# print('Visualizing J(theta_0, theta_1) ...\n')
theta_0 = np.array([np.linspace(-10,10,num=100)])
theta_1 = np.array([np.linspace(-1,4,num=100)])
J_theta = np.array(np.empty((100,100)))for i in range(100):
for j in range(100):
J_theta[i,j] = compC(x,y,[[theta_0[0,i]],[theta_1[0,j]]])from plotData import plot3d
plot3d(theta_0,theta_1.T,J_theta)#------------ end of the code ------------#
My 3d-figure can be plotted. There is a warning that upset me for my
cursor put into the plotting area it will occur.
#------------ the warning error -------------#
Visualizing J(theta_0, theta_1) ...
/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.py:1094: FutureWarning: comparison to None will result in an elementwise object comparison in the future.
if self.button_pressed in self._rotate_btn:
—
Reply to this email directly or view it on GitHub #3898 (comment)
.
@jenshnielsen
Is there any differences between the usage of my code and the example's?
#--------------- my way to plot 3d-figure-----------------#frommaplotlibimportcmfrommpl_toolkits.mplot3d.axes3dimportAxes3DasAx3defplot3d(x,y,J):
fig=plt.figure(2)
ax=Ax3(fig)
ax.plot_surface(x,y,J,rstride=5,cstride=5,cmap=cm.summer_r)
plt.show()
@Edonym I was refering to the original issue. That issue is caused by the ValueError above and is not related to the warning which is harmless at this stage. It just means that we have to fix the code to work with future versions of Numpy
Given the very very strange things (func(..) works, a = func(..) does not) I was seeing in #4506 I am a it worried that there is something is going really sidways pretty far down, but I could believe that it is stale binaries from the cxx refactor.
Hi Guys,
Sorry for the extreme tardiness in replying. This morning I finally got back around to looking at this. I was able to fix this problem by removing everything matplotlib related and reinstalling. Everything looks ok now and the 3D plots are working fine.
Activity
WeatherGod commentedon Dec 7, 2014
This might be related to a recent change. Thoughts, @mdboom?
On Sun, Dec 7, 2014 at 5:57 AM, James McCormac [email protected]
wrote:
edonyzpc commentedon Jan 29, 2015
I got the a problem which is similar. On Mac OSX10.10.2, brew python 2.7.9 and installing matplotlib with pip. When I plotting 3d, I got the problem.
My 3d-figure can be plotted. There is a warning that upset me for my cursor put into the plotting area it will occur.WeatherGod commentedon Jan 29, 2015
That warning is something different, but it is something I need to fix soon.
On Thu, Jan 29, 2015 at 12:31 PM, edony [email protected] wrote:
mdboom commentedon Jan 29, 2015
Hmm... I can't reproduce. Is this still an issue?
jenshnielsen commentedon Jan 29, 2015
The example should work in current master see http://matplotlib.org/devdocs/examples/mplot3d/lines3d_demo.html
edonyzpc commentedon Jan 30, 2015
@jenshnielsen
Is there any differences between the usage of my code and the example's?
jenshnielsen commentedon Jan 30, 2015
@Edonym I was refering to the original issue. That issue is caused by the ValueError above and is not related to the warning which is harmless at this stage. It just means that we have to fix the code to work with future versions of Numpy
If you don't want the warning to show you can use a warning filter with a context manager around the plot to suppress the warning. See https://docs.python.org/2/library/warnings.html
chebee7i commentedon Jun 13, 2015
I'm getting this same error on the dev version of matplotlib (presently fdf1bb5). The test case is to run:
http://matplotlib.org/1.4.3/examples/mplot3d/scatter3d_demo.html
As far as I can tell, none of the mplot3d examples work and the entire toolkit is unusable. My numpy version is '1.10.0.dev0+d770034'.
tacaswell commentedon Jun 13, 2015
I was getting very similar errors in #4506
I ended up running a full bisect from v1.4.3 to master and in the end could not reproduce it with a clean install.
I suspect I was having these issues due to crossed source installs,
seems to be what fixed it for me.
chebee7i commentedon Jun 13, 2015
Fixed it for me as well. Thanks!
efiring commentedon Jun 13, 2015
It looks to me like this can be closed; if anyone disagrees, feel free to reopen it, with an explanation of what the current problem is.
tacaswell commentedon Jun 13, 2015
Given the very very strange things (
func(..)works,a = func(..)does not) I was seeing in #4506 I am a it worried that there is something is going really sidways pretty far down, but I could believe that it is stale binaries from the cxx refactor.jmccormac01 commentedon Sep 13, 2015
Hi Guys,
Sorry for the extreme tardiness in replying. This morning I finally got back around to looking at this. I was able to fix this problem by removing everything matplotlib related and reinstalling. Everything looks ok now and the 3D plots are working fine.
Cheers
James