1

I am currently doing a data science and machine learning course where I attended a lecture on plotly and cufflinks. I am currently using pycharm and trying to plot a 3 dimensional image called 'Surface Plot'. When I run the code, I am getting the output as a blank 3 dimensional figure without any image in it. I have written the code ,attached the output that I am getting and the actual output. How do I get the actual output with the 3D image?

code:

import plotly as py
import plotly.graph_objs as go
import pandas as pd
import numpy as np
from plotly import __version__
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
import cufflinks as cf

print(__version__)
init_notebook_mode(connected=True)
cf.go_offline()
df = pd.DataFrame(np.random.randn(100,4),columns='A B C D'.split())
df2 = pd.DataFrame({'x':[1,2,3,4,5],'y':[10,20,30,20,10],'z':[5,4,3,2,1]})
trace = go.Surface(x=df2['x'],y=df2['y'],z=df2['z'])
data = [trace]
fig = go.Figure(data=data)
py.offline.plot(fig)

This is the output I am getting

This is the output I am getting

This is the actual output:

This is the actual output

Anwarvic
  • 12,156
  • 4
  • 49
  • 69
Rutunjay
  • 11
  • 1

0 Answers0