From 4789d2f590f7524b55922bafe60f5cfc0f1834c4 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Sat, 25 May 2019 11:39:49 -0400 Subject: [PATCH] Check for figure height in the figure template in html export --- plotly/io/_html.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plotly/io/_html.py b/plotly/io/_html.py index 58f123ba3a1..7b9bdb0f760 100644 --- a/plotly/io/_html.py +++ b/plotly/io/_html.py @@ -157,8 +157,15 @@ def to_html(fig, # Get div width/height layout_dict = fig_dict.get('layout', {}) - div_width = layout_dict.get('width', default_width) - div_height = layout_dict.get('height', default_height) + template_dict = (fig_dict + .get('layout', {}) + .get('template', {}) + .get('layout', {})) + + div_width = layout_dict.get( + 'width', template_dict.get('width', default_width)) + div_height = layout_dict.get( + 'height', template_dict.get('height', default_height)) # Add 'px' suffix to numeric widths try: