Skip to content

Commit 813dbbb

Browse files
committed
make iplot() work in http://cloud.sagemath.com
1 parent eefa824 commit 813dbbb

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Diff for: plotly/plotly.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,14 @@ def iplot(self, *args, **kwargs):
4141
res = self.__callplot(*args, **kwargs)
4242
width = kwargs.get('width', 600)
4343
height = kwargs.get('height', 600)
44-
s = '<iframe height="'+str(height+50)+'" id="igraph" scrolling="no" seamless="seamless" src="'+res['url']+'/'+str(width)+'/'+str(height)+'" width="'+str(width+50)+'"></iframe>'
44+
s = '<iframe height="%s" id="igraph" scrolling="no" seamless="seamless" src="%s" width="%s"></iframe>' %\
45+
(height+50, "/".join(map(str, [res['url'], width, height])), width+50)
46+
try:
47+
# see, if we are in the SageMath Cloud
48+
from sage_salvus import html
49+
return html(s, hide=False)
50+
except:
51+
pass
4552
try:
4653
from IPython.display import HTML
4754
return HTML(s)

0 commit comments

Comments
 (0)