Skip to content

Commit 14c84ca

Browse files
authored
Merge pull request #357 from plotly/plotly-offline
2 parents 0f297a7 + 2759daf commit 14c84ca

File tree

2 files changed

+1001
-3
lines changed

2 files changed

+1001
-3
lines changed

plotly/plotly_aux/plotly.m

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,54 @@
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));
1619
if ~any(strcmp('filename',f))
17-
structargs.filename = NaN;
20+
if offline
21+
structargs.filename = 'untitled';
22+
else
23+
structargs.filename = NaN;
24+
end
1825
end
1926
if ~any(strcmp('fileopt',f))
2027
structargs.fileopt = NaN;
2128
end
29+
if any(strcmp('offline', f))
30+
offline = getfield(structargs, 'offline');
31+
end
32+
33+
struct_provided = true;
34+
2235
args = varargin(1:(end-1));
36+
2337
else
24-
structargs = struct('filename', NaN,'fileopt',NaN);
38+
39+
if offline
40+
structargs = struct('filename', 'untitled', 'fileopt', NaN);
41+
else
42+
structargs = struct('filename', NaN,'fileopt',NaN);
43+
end
2544
args = varargin(1:end);
45+
struct_provided = false;
46+
end
47+
48+
if offline
49+
if (struct_provided)
50+
nofig_obj = plotlynofig(varargin{1:end-1}, structargs);
51+
else
52+
nofig_obj = plotlynofig(varargin{1:end}, structargs);
53+
end
54+
nofig_obj.layout.width = 840;
55+
nofig_obj.layout.height = 630;
56+
response = nofig_obj.plotly;
57+
58+
else
59+
response = makecall(args, origin, structargs);
2660
end
2761

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

3063
end

0 commit comments

Comments
 (0)