UC-MACSS / persp-research_Spr18

Course site for MACS 30200 (Spring 2018) - Perspectives on Computational Research
6 stars 33 forks source link

Isses rendering surface plot in python for question #2 #24

Closed TomPCurran closed 6 years ago

TomPCurran commented 6 years ago

I am trying to create a surface plot for the interaction terms for question 2 using python and plotly and I can get the axis to show up but the data itself will not render. I also tried this in R and ran into the same issue.

Suggestions?

screen shot 2018-04-29 at 2 06 31 pm

bensoltoff commented 6 years ago

Are you adding a surface or mesh layer? There is a difference between the two

TomPCurran commented 6 years ago

its a meshlayer I believe

My Code:

plot = go.Mesh3d(

    x = x,
    y = y,
    z = z,
    opacity = 1,
    color = "rgb(39, 100, 0)"
)
layout = go.Layout(
                    scene = dict(
                        xaxis = dict(title="Age"),
                        yaxis = dict(title="Education"),
                        zaxis = dict(title="Biden")),
                    width=700)

fig = go.Figure(data = [plot], layout = layout)

py.iplot(fig)

and the example I am using from plotly API: https://plot.ly/python/3d-axes/

TomPCurran commented 6 years ago

Fixed,

Had to convert x y and z to np arrays