From 4cbbc809625df6efb4930ae2a577b740d23f8c54 Mon Sep 17 00:00:00 2001 From: yankev Date: Mon, 30 May 2016 12:59:25 -0400 Subject: [PATCH 1/3] removed the use of global variable __PLOTLY_USE_CDN, added keyword to docstring; --- plotly/offline/offline.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plotly/offline/offline.py b/plotly/offline/offline.py index d782fa65a7a..626b34d2ec6 100644 --- a/plotly/offline/offline.py +++ b/plotly/offline/offline.py @@ -30,7 +30,6 @@ _matplotlib_imported = False __PLOTLY_OFFLINE_INITIALIZED = False -__PLOTLY_USE_CDN = False def download_plotlyjs(download_url): @@ -53,14 +52,17 @@ def init_notebook_mode(connected=False): Initialize plotly.js in the browser if it hasn't been loaded into the DOM yet. This is an idempotent method and can and should be called from any offline methods that require plotly.js to be loaded into the notebook dom. + + Keyword arguments: + + connected (default=False) -- if connected is True, this means that the + plotly.js library will be loaded from a CDN(online) rather than the + local file from pip. """ if not _ipython_imported: raise ImportError('`iplot` can only run inside an IPython Notebook.') global __PLOTLY_OFFLINE_INITIALIZED - global __PLOTLY_USE_CDN - - __PLOTLY_USE_CDN = connected if connected: # Inject plotly.js into the output cell @@ -76,7 +78,7 @@ def init_notebook_mode(connected=False): 'function(plotly) {window.Plotly=plotly;});' '}}' '' - ) + ) else: # Inject plotly.js into the output cell script_inject = ( From 3d6f1bdde8463ee5cde44b3ece0a8115d2229147 Mon Sep 17 00:00:00 2001 From: yankev Date: Mon, 30 May 2016 13:09:46 -0400 Subject: [PATCH 2/3] updated default plot schema --- plotly/graph_reference/default-schema.json | 80 ++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/plotly/graph_reference/default-schema.json b/plotly/graph_reference/default-schema.json index cc0ae722eec..27cdf82abf6 100644 --- a/plotly/graph_reference/default-schema.json +++ b/plotly/graph_reference/default-schema.json @@ -11230,6 +11230,7 @@ }, "lighting": { "ambient": { + "description": "Ambient light increases overall color visibility but can wash out the image.", "dflt": 0.8, "max": 1, "min": 0, @@ -11237,13 +11238,23 @@ "valType": "number" }, "diffuse": { + "description": "Represents the extent that incident rays are reflected in a range of angles.", "dflt": 0.8, "max": 1, "min": 0, "role": "style", "valType": "number" }, + "facenormalsepsilon": { + "description": "Epsilon for face normals calculation avoids math issues arising from degenerate geometry.", + "dflt": 1e-06, + "max": 1, + "min": 0, + "role": "style", + "valType": "number" + }, "fresnel": { + "description": "Represents the reflectance as a dependency of the viewing angle; e.g. paper is reflective when viewing it from the edge of the paper (almost 90 degrees), causing shine.", "dflt": 0.2, "max": 5, "min": 0, @@ -11252,6 +11263,7 @@ }, "role": "object", "roughness": { + "description": "Alters specular reflection; the rougher the surface, the wider and less contrasty the shine.", "dflt": 0.5, "max": 1, "min": 0, @@ -11259,11 +11271,47 @@ "valType": "number" }, "specular": { + "description": "Represents the level that incident rays are reflected in a single direction, causing shine.", "dflt": 0.05, "max": 2, "min": 0, "role": "style", "valType": "number" + }, + "vertexnormalsepsilon": { + "description": "Epsilon for vertex normals calculation avoids math issues arising from degenerate geometry.", + "dflt": 1e-12, + "max": 1, + "min": 0, + "role": "style", + "valType": "number" + } + }, + "lightposition": { + "role": "object", + "x": { + "description": "Numeric vector, representing the X coordinate for each vertex.", + "dflt": 100000, + "max": 100000, + "min": -100000, + "role": "style", + "valType": "number" + }, + "y": { + "description": "Numeric vector, representing the Y coordinate for each vertex.", + "dflt": 100000, + "max": 100000, + "min": -100000, + "role": "style", + "valType": "number" + }, + "z": { + "description": "Numeric vector, representing the Z coordinate for each vertex.", + "dflt": 0, + "max": 100000, + "min": -100000, + "role": "style", + "valType": "number" } }, "name": { @@ -17937,6 +17985,7 @@ }, "lighting": { "ambient": { + "description": "Ambient light increases overall color visibility but can wash out the image.", "dflt": 0.8, "max": 1, "min": 0, @@ -17944,6 +17993,7 @@ "valType": "number" }, "diffuse": { + "description": "Represents the extent that incident rays are reflected in a range of angles.", "dflt": 0.8, "max": 1, "min": 0, @@ -17951,6 +18001,7 @@ "valType": "number" }, "fresnel": { + "description": "Represents the reflectance as a dependency of the viewing angle; e.g. paper is reflective when viewing it from the edge of the paper (almost 90 degrees), causing shine.", "dflt": 0.2, "max": 5, "min": 0, @@ -17959,6 +18010,7 @@ }, "role": "object", "roughness": { + "description": "Alters specular reflection; the rougher the surface, the wider and less contrasty the shine.", "dflt": 0.5, "max": 1, "min": 0, @@ -17966,6 +18018,7 @@ "valType": "number" }, "specular": { + "description": "Represents the level that incident rays are reflected in a single direction, causing shine.", "dflt": 0.05, "max": 2, "min": 0, @@ -17973,6 +18026,33 @@ "valType": "number" } }, + "lightposition": { + "role": "object", + "x": { + "description": "Numeric vector, representing the X coordinate for each vertex.", + "dflt": 10, + "max": 100000, + "min": -100000, + "role": "style", + "valType": "number" + }, + "y": { + "description": "Numeric vector, representing the Y coordinate for each vertex.", + "dflt": 100000, + "max": 100000, + "min": -100000, + "role": "style", + "valType": "number" + }, + "z": { + "description": "Numeric vector, representing the Z coordinate for each vertex.", + "dflt": 0, + "max": 100000, + "min": -100000, + "role": "style", + "valType": "number" + } + }, "name": { "description": "Sets the trace name. The trace name appear as the legend item and on hover.", "role": "info", From 76232eacff57cde035078a88deadce57d5b2f78c Mon Sep 17 00:00:00 2001 From: yankev Date: Mon, 30 May 2016 15:09:37 -0400 Subject: [PATCH 3/3] updated docstring --- plotly/offline/offline.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/plotly/offline/offline.py b/plotly/offline/offline.py index 626b34d2ec6..efa520976ae 100644 --- a/plotly/offline/offline.py +++ b/plotly/offline/offline.py @@ -55,9 +55,23 @@ def init_notebook_mode(connected=False): Keyword arguments: - connected (default=False) -- if connected is True, this means that the - plotly.js library will be loaded from a CDN(online) rather than the - local file from pip. + connected (default=False) -- If True, the plotly.js library will be loaded + from an online CDN. If False, the plotly.js library will be loaded locally + from the plotly python package + + Use `connected=True` if you want your notebooks to have smaller file sizes. + In the case where `connected=False`, the entirety of the plotly.js library + will be loaded into the notebook, which will result in a file-size increase + of a couple megabytes. Additionally, because the library will be downloaded + from the web, you and your viewers must be connected to the internet to be + able to view charts within this notebook. + + Use `connected=False` if you want you and your collaborators to be able to + create and view these charts regardless of the availability of an internet + connection. This is the default option since it is the most predictable. + Note that under this setting the library will be included inline inside + your notebook, resulting in much larger notebook sizes compared to the case + where `connected=True`. """ if not _ipython_imported: raise ImportError('`iplot` can only run inside an IPython Notebook.') @@ -71,6 +85,7 @@ def init_notebook_mode(connected=False): '