diff --git a/plotly/tools.py b/plotly/tools.py
index 5a03c0a2510..f757a629129 100644
--- a/plotly/tools.py
+++ b/plotly/tools.py
@@ -248,7 +248,8 @@ def get_embed(file_owner_or_url, file_id=None, width="100%", height=525):
s = ("").format(
plotly_rest_url=plotly_rest_url,
@@ -259,7 +260,7 @@ def get_embed(file_owner_or_url, file_id=None, width="100%", height=525):
s = ("").format(
plotly_rest_url=plotly_rest_url,
@@ -291,8 +292,8 @@ def embed(file_owner_or_url, file_id=None, width="100%", height=525):
height (default="525") -- same as width but corresp. to the height of the figure
"""
- s = get_embed(file_owner_or_url, file_id, width, height)
try:
+ s = get_embed(file_owner_or_url, file_id, width, height)
# see if we are in the SageMath Cloud
from sage_salvus import html
return html(s, hide=False)
@@ -306,7 +307,7 @@ def embed(file_owner_or_url, file_id=None, width="100%", height=525):
fid=file_id)
else:
url = file_owner_or_url
- return PlotlyDisplay(url)
+ return PlotlyDisplay(url, width, height)
else:
warnings.warn(
"Looks like you're not using IPython or Sage to embed this plot. "
@@ -571,11 +572,14 @@ class PlotlyDisplay(IPython.core.display.HTML):
object can provide alternate representations.
"""
- def __init__(self, url):
+ def __init__(self, url, width, height):
self.resource = url
- self.embed_code = get_embed(url)
+ self.embed_code = get_embed(url, width=width, height=height)
super(PlotlyDisplay, self).__init__(data=self.embed_code)
+ def _repr_html_(self):
+ return self.embed_code
+
def _repr_svg_(self):
url = self.resource + ".svg"
res = requests.get(url)
diff --git a/plotly/version.py b/plotly/version.py
index 9e0feee723e..5e235eadb36 100644
--- a/plotly/version.py
+++ b/plotly/version.py
@@ -1 +1 @@
-__version__ = '1.4.4'
+__version__ = '1.4.5'