@@ -375,9 +375,10 @@ def make_trace_kwargs(args, trace_spec, trace_data, mapping_labels, sizeref):
375375 trace_patch [error_xy ] = {}
376376 trace_patch [error_xy ][arr ] = trace_data [attr_value ]
377377 elif attr_name == "custom_data" :
378- # here we store a data frame in customdata, and it's serialized
379- # as a list of row lists, which is what we want
380- trace_patch ["customdata" ] = trace_data [attr_value ]
378+ if len (attr_value ) > 0 :
379+ # here we store a data frame in customdata, and it's serialized
380+ # as a list of row lists, which is what we want
381+ trace_patch ["customdata" ] = trace_data [attr_value ]
381382 elif attr_name == "hover_name" :
382383 if trace_spec .constructor not in [
383384 go .Histogram ,
@@ -398,6 +399,13 @@ def make_trace_kwargs(args, trace_spec, trace_data, mapping_labels, sizeref):
398399 for col in attr_value :
399400 if hover_is_dict and not attr_value [col ]:
400401 continue
402+ if col in [
403+ args .get ("x" , None ),
404+ args .get ("y" , None ),
405+ args .get ("z" , None ),
406+ args .get ("base" , None ),
407+ ]:
408+ continue
401409 try :
402410 position = args ["custom_data" ].index (col )
403411 except (ValueError , AttributeError , KeyError ):
@@ -408,9 +416,10 @@ def make_trace_kwargs(args, trace_spec, trace_data, mapping_labels, sizeref):
408416 position
409417 )
410418
411- # here we store a data frame in customdata, and it's serialized
412- # as a list of row lists, which is what we want
413- trace_patch ["customdata" ] = trace_data [customdata_cols ]
419+ if len (customdata_cols ) > 0 :
420+ # here we store a data frame in customdata, and it's serialized
421+ # as a list of row lists, which is what we want
422+ trace_patch ["customdata" ] = trace_data [customdata_cols ]
414423 elif attr_name == "color" :
415424 if trace_spec .constructor in [go .Choropleth , go .Choroplethmapbox ]:
416425 trace_patch ["z" ] = trace_data [attr_value ]
0 commit comments