Black Lives Matter. Please consider donating to Black Girls Code today.

Combining trisurf and scatter plots in one figure

I see one can easily combine graph types as such:

import plotly.graph_objs as go
trace1 = go.Contour()
trace2 = go.Scatter()
data = [trace1, trace2]

But I had no luck so far combining a trisurf and a 3d scatter as such:

from import FigureFactory as FF
fig = FF.create_trisurf()
trace = go.Scatter3d()
data = [fig, trace]

apperently FF is not within the valid items list:

Valid items for 'data' at path ['data'] under parents ['figure']:
    ['Box', 'Mesh3d', 'Histogram', 'Bar', 'Scattergeo', 'Area',
    'Choropleth', 'Scatterternary', 'Surface', 'Pie', 'Heatmap',
    'Scattermapbox', 'Scatter', 'Histogram2d', 'Pointcloud',
    'Histogram2dcontour', 'Contour', 'Scattergl', 'Scatter3d']

any thoughts?

The reason this is failing is because your fig = FF.create_trisurf() will output a dictionary of the data and the layout together. Normally, this object would be used for plotting. But by running py.iplot on a list of traces (eg. [trace1, trace2, …]) you can add a layout to all of those.

So what I suggest to do is to extract all the items contained in and insert them into your data list. So it may look like this:

data = [[0],[1], trace]

Thank! that seems to work.