Skip to content

Commit 6ae5fb6

Browse files
committed
Offline mode is now default for plotly().
1 parent 998b595 commit 6ae5fb6

File tree

2 files changed

+994
-2
lines changed

2 files changed

+994
-2
lines changed

plotly/plotly_aux/plotly.m

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
%
1111
% For full documentation and examples, see https://plot.ly/api
1212
origin = 'plot';
13+
offline = true;
14+
struct_provided = false;
15+
1316
if isstruct(varargin{end})
1417
structargs = varargin{end};
1518
f = lower(fieldnames(structargs));
@@ -19,12 +22,36 @@
1922
if ~any(strcmp('fileopt',f))
2023
structargs.fileopt = NaN;
2124
end
25+
if any(strcmp('offline', f))
26+
offline = getfield(structargs, 'offline');
27+
end
28+
29+
struct_provided = true;
30+
2231
args = varargin(1:(end-1));
2332
else
24-
structargs = struct('filename', NaN,'fileopt',NaN);
33+
if offline
34+
structargs = struct('filename', 'untitled', 'fileopt', NaN);
35+
else
36+
structargs = struct('filename', NaN,'fileopt',NaN);
37+
end
2538
args = varargin(1:end);
39+
struct_provided = false;
40+
end
41+
42+
if(offline)
43+
if struct_provided
44+
nofig_obj = plotlynofig(varargin{1:end-1}, structargs);
45+
else
46+
nofig_obj = plotlynofig(varargin{1:end}, structargs);
47+
end
48+
nofig_obj.layout.width = 840;
49+
nofig_obj.layout.height = 630;
50+
response = nofig_obj.plotly;
51+
52+
else
53+
response = makecall(args, origin, structargs);
2654
end
2755

28-
response = makecall(args, origin, structargs);
2956

3057
end

0 commit comments

Comments
 (0)