Skip to content

Commit 54c1386

Browse files
committed
added Andrew's #586 PR
1 parent b4c3953 commit 54c1386

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

plotly/graph_objs/graph_objs.py

+14
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,20 @@ def __init__(self, *args, **kwargs):
836836
_parent_key='data')
837837
figure_class.__init__ = __init__
838838

839+
def __setitem__(self, key, value, **kwargs):
840+
if key == 'frames':
841+
super(PlotlyDict, self).__setitem__(key, value)
842+
else:
843+
super(figure_class, self).__setitem__(key, value, **kwargs)
844+
figure_class.__setitem__ = __setitem__
845+
846+
def _get_valid_attributes(self):
847+
super(figure_class, self)._get_valid_attributes()
848+
if 'frames' not in self._valid_attributes:
849+
self._valid_attributes.add('frames')
850+
return self._valid_attributes
851+
figure_class._get_valid_attributes = _get_valid_attributes
852+
839853
def get_data(self, flatten=False):
840854
"""
841855
Returns the JSON for the plot with non-data elements stripped.

plotly/graph_reference.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
'ErrorZ': {'object_name': 'error_z', 'base_type': dict},
3939
'Figure': {'object_name': 'figure', 'base_type': dict},
4040
'Font': {'object_name': 'font', 'base_type': dict},
41+
'Frames': {'object_name': 'frames', 'base_type': dict},
4142
'Heatmap': {'object_name': 'heatmap', 'base_type': dict},
4243
'Histogram': {'object_name': 'histogram', 'base_type': dict},
4344
'Histogram2d': {'object_name': 'histogram2d', 'base_type': dict},
@@ -87,7 +88,6 @@ def get_graph_reference():
8788

8889
graph_reference_url = '{}{}?sha1={}'.format(plotly_api_domain,
8990
GRAPH_REFERENCE_PATH, sha1)
90-
9191
try:
9292
response = requests.get(graph_reference_url,
9393
timeout=GRAPH_REFERENCE_DOWNLOAD_TIMEOUT)
@@ -196,11 +196,9 @@ def get_valid_attributes(object_name, parent_object_names=()):
196196
# These are for documentation and quick lookups. They're just strings.
197197
valid_attributes = set()
198198
for attributes_dict in attributes.values():
199-
200199
for key, val in attributes_dict.items():
201200
if key not in GRAPH_REFERENCE['defs']['metaKeys']:
202201
valid_attributes.add(key)
203-
204202
deprecated_attributes = attributes_dict.get('_deprecated', {})
205203
for key, val in deprecated_attributes.items():
206204
if key not in GRAPH_REFERENCE['defs']['metaKeys']:

plotly/plotly/plotly.py

+3
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,9 @@ def plot(figure_or_data, validate=True, **plot_options):
209209
Make this figure private/public
210210
211211
"""
212+
#if 'frames' in figure_or_data:
213+
# figure = tools.return_figure_from_figure_or_data(figure_or_data, False)
214+
#else:
212215
figure = tools.return_figure_from_figure_or_data(figure_or_data, validate)
213216

214217
for entry in figure['data']:

0 commit comments

Comments
 (0)