@@ -254,6 +254,7 @@ def __init__(
254254 auto_play = False ,
255255 post_script = None ,
256256 animation_opts = None ,
257+ include_plotlyjs = True ,
257258 ):
258259
259260 self .config = dict (config ) if config else {}
@@ -263,6 +264,7 @@ def __init__(
263264 self .full_html = full_html
264265 self .animation_opts = animation_opts
265266 self .post_script = post_script
267+ self .include_plotlyjs = "cdn" if self .connected else include_plotlyjs
266268
267269 def activate (self ):
268270 if self .global_init :
@@ -307,12 +309,7 @@ def to_mimebundle(self, fig_dict):
307309
308310 from plotly .io import to_html
309311
310- if self .connected :
311- include_plotlyjs = "cdn"
312- include_mathjax = "cdn"
313- else :
314- include_plotlyjs = True
315- include_mathjax = "cdn"
312+ include_mathjax = "cdn"
316313
317314 # build post script
318315 post_script = [
@@ -352,7 +349,7 @@ def to_mimebundle(self, fig_dict):
352349 fig_dict ,
353350 config = self .config ,
354351 auto_play = self .auto_play ,
355- include_plotlyjs = include_plotlyjs ,
352+ include_plotlyjs = self . include_plotlyjs ,
356353 include_mathjax = include_mathjax ,
357354 post_script = post_script ,
358355 full_html = self .full_html ,
@@ -385,6 +382,7 @@ def __init__(
385382 auto_play = False ,
386383 post_script = None ,
387384 animation_opts = None ,
385+ include_plotlyjs = False ,
388386 ):
389387 super (NotebookRenderer , self ).__init__ (
390388 connected = connected ,
@@ -394,6 +392,7 @@ def __init__(
394392 auto_play = auto_play ,
395393 post_script = post_script ,
396394 animation_opts = animation_opts ,
395+ include_plotlyjs = include_plotlyjs ,
397396 )
398397
399398
@@ -421,6 +420,7 @@ def __init__(
421420 auto_play = auto_play ,
422421 post_script = post_script ,
423422 animation_opts = animation_opts ,
423+ include_plotlyjs = False ,
424424 )
425425
426426
@@ -448,6 +448,7 @@ def __init__(
448448 auto_play = auto_play ,
449449 post_script = post_script ,
450450 animation_opts = animation_opts ,
451+ include_plotlyjs = False ,
451452 )
452453
453454
0 commit comments