Skip to content

Commit 56d961d

Browse files
Merge pull request #363 from plotly/plotly-offline
Fixed problem when using plotly online.
2 parents 9f51358 + 84e6d1c commit 56d961d

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

plotly/plotly_aux/plotly.m

+14-6
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,22 @@
1010
%
1111
% For full documentation and examples, see https://plot.ly/api
1212
origin = 'plot';
13-
offline = false;
13+
offline_given = true;
1414
struct_provided = false;
1515

1616
if isstruct(varargin{end})
1717
structargs = varargin{end};
1818
f = lower(fieldnames(structargs));
19+
20+
if any(strcmp('offline', f))
21+
offline = getfield(structargs, 'offline');
22+
offline_given = offline;
23+
else
24+
offline = false;
25+
offline_given = offline;
26+
end
27+
28+
1929
if ~any(strcmp('filename',f))
2030
if offline
2131
structargs.filename = 'untitled';
@@ -26,17 +36,15 @@
2636
if ~any(strcmp('fileopt',f))
2737
structargs.fileopt = NaN;
2838
end
29-
if any(strcmp('offline', f))
30-
offline = getfield(structargs, 'offline');
31-
end
39+
3240

3341
struct_provided = true;
3442

3543
args = varargin(1:(end-1));
3644

3745
else
3846

39-
if offline
47+
if offline_given
4048
structargs = struct('filename', 'untitled', 'fileopt', NaN);
4149
else
4250
structargs = struct('filename', NaN,'fileopt',NaN);
@@ -45,7 +53,7 @@
4553
struct_provided = false;
4654
end
4755

48-
if offline
56+
if offline_given
4957
if (struct_provided)
5058
nofig_obj = plotlynofig(varargin{1:end-1}, structargs);
5159
else

0 commit comments

Comments
 (0)