Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d88c5d0

Browse filesBrowse files
author
Kevin Yan
committed
Merge pull request plotly#440 from plotly/offline_plot
Fix for 1.9.8 offline plotting issue
2 parents a918639 + fa4bb02 commit d88c5d0
Copy full SHA for d88c5d0

File tree

Expand file treeCollapse file tree

3 files changed

+17
-9
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+17
-9
lines changed

‎CHANGELOG.md

Copy file name to clipboardExpand all lines: CHANGELOG.md
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@ This project adheres to [Semantic Versioning](http://semver.org/).
44

55
## [Unreleased]
66

7+
## [1.9.9] - 2016-04-15
8+
### Fixed
9+
- Fixed `require is not defined` issue when plotting offline outside of Ipython Notebooks.
10+
711
## [1.9.8] - 2016-04-14
812
### Fixed
913
- Error no longer results from a "Run All" cells when working in a Jupyter Notebook.
1014

1115
### Updated
1216
- Updated plotly.min.js so offline is using plotly.js v1.9.0
13-
- Added Ternary plots with support for scatter traces (trace type `scatterternary`)
17+
- Added Ternary plots with support for scatter traces (trace type `scatterternary`, currently only available in offline mode)
1418
- For comprehensive update list see the [plotly.js CHANGELOG](https://github.com/plotly/plotly.js/blob/master/CHANGELOG.md)
1519

1620
## [1.9.7] - 2016-04-04

‎plotly/offline/offline.py

Copy file name to clipboardExpand all lines: plotly/offline/offline.py
+11-7Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def init_notebook_mode():
7373

7474

7575
def _plot_html(figure_or_data, show_link, link_text,
76-
validate, default_width, default_height):
76+
validate, default_width, default_height, global_requirejs):
7777

7878
figure = tools.return_figure_from_figure_or_data(figure_or_data, validate)
7979

@@ -121,17 +121,21 @@ def _plot_html(figure_or_data, show_link, link_text,
121121
layout=jlayout,
122122
config=jconfig)
123123

124+
optional_line1 = ('require(["plotly"], function(Plotly) {{ '
125+
if global_requirejs else '')
126+
optional_line2 = '}});' if global_requirejs else ''
127+
124128
plotly_html_div = (
125129
''
126130
'<div id="{id}" style="height: {height}; width: {width};" '
127131
'class="plotly-graph-div">'
128132
'</div>'
129-
'<script type="text/javascript">'
130-
'require(["plotly"], function(Plotly) {{'
133+
'<script type="text/javascript">' +
134+
optional_line1 +
131135
'window.PLOTLYENV=window.PLOTLYENV || {{}};'
132136
'window.PLOTLYENV.BASE_URL="' + plotly_platform_url + '";'
133-
'{script}'
134-
'}});'
137+
'{script}' +
138+
optional_line2 +
135139
'</script>'
136140
'').format(
137141
id=plotdivid, script=script,
@@ -189,7 +193,7 @@ def iplot(figure_or_data, show_link=True, link_text='Export to plot.ly',
189193

190194
plot_html, plotdivid, width, height = _plot_html(
191195
figure_or_data, show_link, link_text, validate,
192-
'100%', 525)
196+
'100%', 525, global_requirejs=True)
193197

194198
display(HTML(plot_html))
195199

@@ -258,7 +262,7 @@ def plot(figure_or_data,
258262

259263
plot_html, plotdivid, width, height = _plot_html(
260264
figure_or_data, show_link, link_text, validate,
261-
'100%', '100%')
265+
'100%', '100%', global_requirejs=False)
262266

263267
resize_script = ''
264268
if width == '100%' or height == '100%':

‎plotly/version.py

Copy file name to clipboard
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '1.9.8'
1+
__version__ = '1.9.9'

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.