Skip to content

Commit 9c1d9bc

Browse files
author
Ashish Vora
committed
#135 - add an option to specify a save location different from pwd for offline. default is pwd
1 parent 146808b commit 9c1d9bc

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

plotly/plotly_offline_aux/plotlyoffline.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
html_filename = [clean_filename '.html'];
7878

7979
% save the html file in the working directory
80-
plotly_offline_file = fullfile(pwd, html_filename);
80+
plotly_offline_file = fullfile(plotlyfig.PlotOptions.SaveFolder, html_filename);
8181
file_id = fopen(plotly_offline_file, 'w');
8282
fprintf(file_id, offline_script);
8383
fclose(file_id);

plotly/plotlyfig.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@
6565
obj.PlotOptions.ShowLinkText = true;
6666
obj.PlotOptions.LinkText = obj.get_link_text;
6767
obj.PlotOptions.IncludePlotlyjs = true;
68-
68+
obj.PlotOptions.SaveFolder = pwd;
69+
6970
%-PlotlyDefaults-%
7071
obj.PlotlyDefaults.MinTitleMargin = 80;
7172
obj.PlotlyDefaults.TitleHeight = 0.01;
@@ -152,6 +153,9 @@
152153
% overwrite if filename provided
153154
obj.PlotOptions.FileOpt = 'overwrite';
154155
end
156+
if(strcmpi(varargin{a},'savefolder'))
157+
obj.PlotOptions.SaveFolder = varargin{a+1};
158+
end
155159
if(strcmpi(varargin{a},'fileopt'))
156160
obj.PlotOptions.FileOpt = varargin{a+1};
157161
end

0 commit comments

Comments
 (0)