MCPcopy Index your code
hub / github.com/plotly/plotly.py / to_dict

Method to_dict

plotly/basedatatypes.py:3293–3324  ·  view source on GitHub ↗

Convert figure to a dictionary Note: the dictionary includes the properties explicitly set by the user, it does not include default values of unspecified properties Returns ------- dict

(self)

Source from the content-addressed store, hash-verified

3291 # Exports
3292 # -------
3293 def to_dict(self):
3294 """
3295 Convert figure to a dictionary
3296
3297 Note: the dictionary includes the properties explicitly set by the
3298 user, it does not include default values of unspecified properties
3299
3300 Returns
3301 -------
3302 dict
3303 """
3304 # Handle data
3305 # -----------
3306 data = deepcopy(self._data)
3307
3308 # Handle layout
3309 # -------------
3310 layout = deepcopy(self._layout)
3311
3312 # Handle frames
3313 # -------------
3314 # Frame key is only added if there are any frames
3315 res = {"data": data, "layout": layout}
3316 frames = deepcopy([frame._props for frame in self._frame_objs])
3317
3318 if frames:
3319 res["frames"] = frames
3320
3321 # Add base64 conversion before sending to the front-end
3322 convert_to_base64(res)
3323
3324 return res
3325
3326 def to_plotly_json(self):
3327 """

Callers 15

__reduce__Method · 0.95
to_plotly_jsonMethod · 0.95
setUpMethod · 0.80
setUpMethod · 0.80

Calls 1

convert_to_base64Function · 0.90