Skip to content

Commit 1165495

Browse files
committed
Fixed an issue where plotly offline will not work if the filename is not provided.
1 parent 6ae5fb6 commit 1165495

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

plotly/plotly_aux/plotly.m

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717
structargs = varargin{end};
1818
f = lower(fieldnames(structargs));
1919
if ~any(strcmp('filename',f))
20-
structargs.filename = NaN;
20+
if offline
21+
structargs.filename = 'untitled';
22+
else
23+
structargs.filename = NaN;
24+
end
2125
end
2226
if ~any(strcmp('fileopt',f))
2327
structargs.fileopt = NaN;
@@ -29,20 +33,23 @@
2933
struct_provided = true;
3034

3135
args = varargin(1:(end-1));
36+
3237
else
38+
3339
if offline
34-
structargs = struct('filename', 'untitled', 'fileopt', NaN);
40+
structargs = struct('filename', 'untitled', 'fileopt', NaN)
3541
else
3642
structargs = struct('filename', NaN,'fileopt',NaN);
3743
end
3844
args = varargin(1:end);
3945
struct_provided = false;
4046
end
4147

42-
if(offline)
43-
if struct_provided
48+
if offline
49+
if (struct_provided)
4450
nofig_obj = plotlynofig(varargin{1:end-1}, structargs);
4551
else
52+
structargs
4653
nofig_obj = plotlynofig(varargin{1:end}, structargs);
4754
end
4855
nofig_obj.layout.width = 840;

0 commit comments

Comments
 (0)