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
axes3d.py error when using lines3d and surface3d demos #3898
Comments
This might be related to a recent change. Thoughts, @mdboom? On Sun, Dec 7, 2014 at 5:57 AM, James McCormac notifications@github.com
|
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 ------------#
#------------ 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: |
That warning is something different, but it is something I need to fix soon. On Thu, Jan 29, 2015 at 12:31 PM, edony notifications@github.com wrote:
|
Hmm... I can't reproduce. Is this still an issue? |
The example should work in current master see http://matplotlib.org/devdocs/examples/mplot3d/lines3d_demo.html |
@jenshnielsen #--------------- my way to plot 3d-figure-----------------#
from maplotlib import cm
from mpl_toolkits.mplot3d.axes3d import Axes3D as Ax3
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() |
@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 def plot3d(x,y,J):
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=FutureWarning)
fig = plt.figure(2)
ax = Ax3(fig)
ax.plot_surface(x,y,J,rstride=5,cstride=5,cmap=cm.summer_r)
plt.show() |
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'. |
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. |
Fixed it for me as well. Thanks! |
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. |
Given the very very strange things ( |
Hi Guys, Cheers |
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.
Cheers
James
Mac OS X 10.10.1 Yosemite
after a few seconds with the figure open this appears:
[TAC edited formatting]
The text was updated successfully, but these errors were encountered: