Learn how to use Dash Bio for next-gen sequencing & quality control. 🧬 Register for the Oct 27 webinar.

Go.figure problem

    fig = go.Figure(data=data[3], layout=layout)
  File "C:\Users\SMADDUL\AppData\Local\Continuum\anaconda3\lib\site-packages\plotly\graph_objs\_figure.py", line 611, in __init__
    super(Figure, self).__init__(data, layout, frames, skip_invalid, **kwargs)
  File "C:\Users\SMADDUL\AppData\Local\Continuum\anaconda3\lib\site-packages\plotly\basedatatypes.py", line 157, in __init__
    data = self._data_validator.validate_coerce(data, skip_invalid=skip_invalid)
  File "C:\Users\SMADDUL\AppData\Local\Continuum\anaconda3\lib\site-packages\_plotly_utils\basevalidators.py", line 2656, in validate_coerce
    skip_invalid=skip_invalid, **v_copy
TypeError: __init__() keywords must be strings

My data consists of [a,b,c,d]

I manually debugged where it is going wrong and i found that a,b and c doesnt have problem and d is the problem. d consists of data go.Mesh data like Mesh3d({color = black,i=[list of some 30k elements],j=[list of some 30k elements],k=[list of 30k elements],opacity=[some list], x=[28k elemt],y=[28k elements],z=[28k elements]})

Sorry for not expressing you more clearly as i shouldn’t. Thanks for understanding. Please feel free to give any inputs.

Hi @sandy97 welcome to the forum! It’s hard to help you debugging without a standalone code, could you do a print(data[3]) and print(layout) and post the result here? Also in the Mesh3d definition you don’t need the { I think.

Hi @Emmanuelle. Thanks for the quick reply and apologies for my late reply. I also found my problem is bit different than expressed in the question.

My data is [a,b,c,d]. And here the problem is with d element in data because d element is a tuple. And d element consists of four elements inside it.

I hope this is clear now. In case if you need further information please ask me @Emmanuelle. I will try my best to provide.

Layout({
    'scene': {'aspectmode': 'data'}, 'showlegend': False
})
d[0]=[1,145,24]
d[1]={1:{'a': [-4452.454423, -974.3933333333333, -314.00815384615385], 'b': [-3532.82, -1124.3, -459.468], 'point_index': array([ ], shape=(1,0),dtype=int64),2:{'a': [-4452.454423, -974.3933333333333, -314.00815384615385], 'b': [-3532.82, -1124.3, -459.468], 'index': array([ ], shape=(1,0),dtype=int64)} and it is much bigger than this
d[2]=array([[ -578.098,  1030.79 ,   720.607],
       [ -578.112,  1030.64 ,   720.294],
       [ -578.061,  1030.85 ,   721.385],
       ...,
       [-3988.32 ,   819.307,   656.27 ],
       [-3985.28 ,   822.333,   657.16 ],
       [-3988.3  ,   822.359,   656.969]])
d[3]=Mesh3d({
    'color': 'blue',
    'i': [1121, 339, 711, ..., 273988, 273988, 273988],
    'j': [1083, 481, 481, ..., 273960, 273967, 273997],
    'k': [990, 711, 1083, ..., 273967, 273997, 274012],
    'opacity': 1,
    'x': [-0.578098, -0.578112, -0.578061, ..., -3.9883200000000003,
          -3.9852800000000004, -3.9883],
    'y': [1.0307899999999999, 1.03064, 1.0308499999999998, ..., 0.819307,
          0.822333, 0.8223590000000001],
    'z': [0.720607, 0.720294, 0.7213849999999999, ..., 0.65627, 0.65716, 0.656969]
})
I dont have problem when data = [a b c d[3]] but when i use data= [a b c d]. Then i am getting a problem. I also need to use d[0] d[1] d[2] in the same plot. Is that possible?

Please forgive me i am naive to plotly and also to this community forum. But thanks a lot for your patience.

d[0] and d[1] were fixed and currently finding a way to fix d[2]. Thanks a lot for insights.