import plotly.plotly as py import numpy as np from plotly.graph_objs import * x1 = y1 = np.arange(-1,1,0.4) yt1 = x1[:,np.newaxis] print np.shape(yt1) print '***' print yt1 print x1, '-->', np.shape(x1) print y1, '-->', np.shape(y1) print x1*y1, '-->', np.shape(x1*y1) print x1*yt1 print '***' print x = y = np.arange(-5,5,0.1) yt = x[:,np.newaxis] z = np.cos(x*yt)+np.sin(x*yt) np.size(z) # this is how many points we're plotting %%capture # capture to suppress help() output # remeber you can always call help on Plotly objects help(Surface) # aquatic colorscale cls=[[0, 'rgb(0,0,131)'], [0.125, 'rgb(0,60,170)'], [0.375, 'rgb(5,255,255)'], [0.625, 'rgb(255,255,0)'], [0.875, 'rgb(250,0,0)'], [1, 'rgb(128,0,0)']] data = Data([ Surface( x=x, y=y, z=z, colorscale=cls ) ]) layout = Layout( title='waaaaves', autosize=True, scene=Scene( zaxis=ZAxis(range=[-5, 5],domain=[-5, 5],autorange=False,nticks=10,gridcolor='rgb(255, 255, 255)',gridwidth=2,zerolinecolor='rgb(255, 255, 255)',zerolinewidth=2), xaxis=XAxis(nticks=10,gridcolor='rgb(255, 255, 255)',gridwidth=2,zerolinecolor='rgb(255, 255, 255)',zerolinewidth=2), yaxis=YAxis(nticks=10,gridcolor='rgb(255, 255, 255)',gridwidth=2,zerolinecolor='rgb(255, 255, 255)',zerolinewidth=2), bgcolor="rgb(244, 244, 248)" ) ) fig = Figure(data=data, layout=layout) # As of Plotly's python package plotly-1.5.0 # 2d contours in 3d plots aren't supported, # but you can hack them in like this. # Stayed tuned for updates. contours = { 'z':{ 'show':True } } fig['data'][0]['contours'] = contours # validate = False prevents syntax checking that would complain about the 2d contour hack (see above) py.iplot(fig, filename='waaaaves', validate=False) from IPython.core.display import HTML import urllib2 HTML( urllib2.urlopen('http://bit.ly/1Bf5Hft').read() )