From c3f6cd7dd09e18dea172dc7f47c3258d84125ce5 Mon Sep 17 00:00:00 2001 From: Jolinos Date: Fri, 27 Aug 2021 19:11:15 +0100 Subject: [PATCH] Fixed problem when using plotly online. --- plotly/plotly_aux/plotly.m | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/plotly/plotly_aux/plotly.m b/plotly/plotly_aux/plotly.m index 3a977f00..b488a499 100644 --- a/plotly/plotly_aux/plotly.m +++ b/plotly/plotly_aux/plotly.m @@ -10,12 +10,22 @@ % % For full documentation and examples, see https://plot.ly/api origin = 'plot'; -offline = true; +offline_given = true; struct_provided = false; if isstruct(varargin{end}) structargs = varargin{end}; f = lower(fieldnames(structargs)); + + if any(strcmp('offline', f)) + offline = getfield(structargs, 'offline'); + offline_given = offline; + else + offline = false; + offline_given = offline; + end + + if ~any(strcmp('filename',f)) if offline structargs.filename = 'untitled'; @@ -26,9 +36,7 @@ if ~any(strcmp('fileopt',f)) structargs.fileopt = NaN; end - if any(strcmp('offline', f)) - offline = getfield(structargs, 'offline'); - end + struct_provided = true; @@ -36,7 +44,7 @@ else - if offline + if offline_given structargs = struct('filename', 'untitled', 'fileopt', NaN); else structargs = struct('filename', NaN,'fileopt',NaN); @@ -45,7 +53,7 @@ struct_provided = false; end -if offline +if offline_given if (struct_provided) nofig_obj = plotlynofig(varargin{1:end-1}, structargs); else