Skip to content

Commit 0fb8600

Browse files
committed
Merge branch 'ipyplotly_integration' of https://github.com/plotly/plotly.py into ipyplotly_integration
2 parents bffb1c0 + af779c3 commit 0fb8600

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

Diff for: plotly/figure_factory/_facet_grid.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ def _axis_title_annotation(text, x_or_y_axis):
143143

144144
def _add_shapes_to_fig(fig, annot_rect_color, flipped_rows=False,
145145
flipped_cols=False):
146-
fig['layout']['shapes'] = []
147-
for key in fig['layout'].keys():
146+
shapes_list = []
147+
for key in fig['layout'].to_plotly_json().keys():
148148
if 'axis' in key and fig['layout'][key]['domain'] != [0.0, 1.0]:
149149
shape = {
150150
'fillcolor': annot_rect_color,
@@ -163,7 +163,7 @@ def _add_shapes_to_fig(fig, annot_rect_color, flipped_rows=False,
163163

164164
if flipped_cols:
165165
shape['y1'] += 0.5
166-
fig['layout']['shapes'].append(shape)
166+
shapes_list.append(shape)
167167

168168
elif 'yaxis' in key:
169169
shape['x0'] = 1.005
@@ -173,7 +173,9 @@ def _add_shapes_to_fig(fig, annot_rect_color, flipped_rows=False,
173173

174174
if flipped_rows:
175175
shape['x1'] += 1
176-
fig['layout']['shapes'].append(shape)
176+
shapes_list.append(shape)
177+
178+
fig['layout']['shapes'] = shapes_list
177179

178180

179181
def _make_trace_for_scatter(trace, trace_type, color, **kwargs_marker):

Diff for: plotly/plotly/plotly.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,14 @@ def iplot(figure_or_data, **plot_options):
150150
layout = {}
151151

152152
embed_options = dict()
153-
embed_options['width'] = layout.get('width', '100%')
154-
embed_options['height'] = layout.get('height', 525)
153+
try:
154+
embed_options['width'] = layout.to_plotly_json().get('width', '100%')
155+
except AttributeError:
156+
embed_options['width'] = layout.get('width', '100%')
157+
try:
158+
embed_options['height'] = layout.to_plotly_json().get('height', 525)
159+
except AttributeError:
160+
embed_options['height'] = layout.get('height', 525)
155161
try:
156162
float(embed_options['width'])
157163
except (ValueError, TypeError):

0 commit comments

Comments
 (0)