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