diff --git a/plotly/addtheme.m b/plotly/addtheme.m
index f016150d..56e50f4c 100644
--- a/plotly/addtheme.m
+++ b/plotly/addtheme.m
@@ -1,7 +1,4 @@
function f = addtheme(f, theme)
-
- %-------------------------------------------------------------------------%
-
%-validate theme name-%
themePath = 'plotly/themes';
@@ -9,29 +6,27 @@
if isempty(S)
paths = split(path, ':');
-
for p = 1:length(paths)
if ~isempty(strfind(paths{p}, themePath))
themePath = paths{p};
break;
end
end
-
S = dir(themePath);
end
N = {S.name};
if ~any(strcmp(N,strcat(theme, '.json'))) == 1
- ME = MException('MyComponent:noSuchVariable',...
- [strcat('\n', theme,...
- ' is not a supported themes.'),...
- ' Please choose one of these theme names:\n\n',...
- strrep(strrep([S.name], '...', ''), '.json', ' | ')]);
+ ME = MException('MyComponent:noSuchVariable', ...
+ [strcat('\n', theme, ...
+ ' is not a supported themes.'), ...
+ ' Please choose one of these theme names:\n\n', ...
+ strrep(strrep([S.name], '...', ''), '.json', ' | ')]);
throw(ME)
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-add theme to figure-%
@@ -54,6 +49,4 @@
disp(strcat('layout.plot_bgcolor:::',...
f.layout.template.layout.plot_bgcolor))
end
-
- %-------------------------------------------------------------------------%
end
diff --git a/plotly/fig2plotly.m b/plotly/fig2plotly.m
index 73e1f0d2..660135ac 100644
--- a/plotly/fig2plotly.m
+++ b/plotly/fig2plotly.m
@@ -1,53 +1,46 @@
function p = fig2plotly(varargin)
+ %----------------------------FIG2PLOTLY-------------------------------%
-%------------------------------FIG2PLOTLY---------------------------------%
+ % Convert a MATLAB figure to a Plotly Figure
-% Convert a MATLAB figure to a Plotly Figure
+ % [CALL]:
-% [CALL]:
+ % p = fig2plotly
+ % p = fig2plotly(fig_han)
+ % p = fig2plotly(fig_han, 'property', value, ...)
-% p = fig2plotly
-% p = fig2plotly(fig_han)
-% p = fig2plotly(fig_han, 'property', value, ...)
+ % [INPUTS]: [TYPE]{default} - description/'options'
-% [INPUTS]: [TYPE]{default} - description/'options'
+ % fig_han: [handle]{gcf} - figure handle
+ % fig_struct: [structure array]{get(gcf)} - figure handle structure
+ % array
-% fig_han: [handle]{gcf} - figure handle
-% fig_struct: [structure array]{get(gcf)} - figure handle structure array
+ % [VALID PROPERTIES / VALUES]:
-% [VALID PROPERTIES / VALUES]:
+ % filename: [string]{'untitled'} - filename as appears on Plotly
+ % fileopt: [string]{'new'} - 'new, overwrite, extend, append'
+ % world_readable: [boolean]{true} - public(true) / private(false)
+ % link: [boolean]{true} - show hyperlink (true) / no hyperlink (false)
+ % open: [boolean]{true} - open plot in browser (true)
-% filename: [string]{'untitled'} - filename as appears on Plotly
-% fileopt: [string]{'new'} - 'new, overwrite, extend, append'
-% world_readable: [boolean]{true} - public(true) / private(false)
-% link: [boolean]{true} - show hyperlink (true) / no hyperlink (false)
-% open: [boolean]{true} - open plot in browser (true)
+ % [OUTPUT]:
-% [OUTPUT]:
+ % p - plotlyfig object
-% p - plotlyfig object
+ % [ADDITIONAL RESOURCES]:
-% [ADDITIONAL RESOURCES]:
+ % For full documentation and examples, see https://plot.ly/matlab
-% For full documentation and examples, see https://plot.ly/matlab
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %--FIGURE INITIALIZATION--%
+ if nargin == 0
+ varargin{1} = gcf;
+ end
-%--FIGURE INITIALIZATION--%
-if nargin == 0
- varargin{1} = gcf;
-end
-
-%-------------------------------------------------------------------------%
-
-%--CONSTRUCT PLOTLY FIGURE OBJECT--%
-p = plotlyfig(varargin{:});
-
-%-------------------------------------------------------------------------%
-
-%--MAKE CALL TO PLOTLY--%
-p.plotly;
-
-%-------------------------------------------------------------------------%
+ %--CONSTRUCT PLOTLY FIGURE OBJECT--%
+ p = plotlyfig(varargin{:});
+ %--MAKE CALL TO PLOTLY--%
+ p.plotly;
end
diff --git a/plotly/getplotlyfig.m b/plotly/getplotlyfig.m
index 0b26c2ae..da4f95b6 100644
--- a/plotly/getplotlyfig.m
+++ b/plotly/getplotlyfig.m
@@ -1,29 +1,24 @@
function p = getplotlyfig(file_owner, file_id)
+ %-----------------------------SAVEPLOTLYFIG---------------------------%
+ % Grab an online Plotly figure's data/layout information
+ % [CALL]:
+ % p = getplotlyfig(file_owner file_id)
+ % [INPUTS]: [TYPE]{default} - description/'options'
+ % file_owner: [string]{} - Unique Plotly username
+ % file_id [int]{} - the id of the graph you want to obtain
+ % [OUTPUT]:
+ % p - plotlyfig object
+ % [EXAMPLE]:
+ % url: https://plot.ly/~demos/1526
+ % fig = getplotlyfig('demos','1526');
+ % [ADDITIONAL RESOURCES]:
+ % For full documentation and examples, see
+ % https://plot.ly/matlab/get-requests/
+ %---------------------------------------------------------------------%
-%-----------------------------SAVEPLOTLYFIG-------------------------------%
-% Grab an online Plotly figure's data/layout information
-% [CALL]:
-% p = getplotlyfig(file_owner file_id)
-% [INPUTS]: [TYPE]{default} - description/'options'
-% file_owner: [string]{} - Unique Plotly username
-% file_id [int]{} - the id of the graph you want to obtain
-% [OUTPUT]:
-% p - plotlyfig object
-% [EXAMPLE]:
-% url: https://plot.ly/~demos/1526
-% fig = getplotlyfig('demos','1526');
-% [ADDITIONAL RESOURCES]:
-% For full documentation and examples, see https://plot.ly/matlab/get-requests/
-%-------------------------------------------------------------------------%
-
-%--CONSTRUCT PLOTLY FIGURE OBJECT--%
-p = plotlyfig('Visible','off');
-
-%-------------------------------------------------------------------------%
-
-%--MAKE CALL TO DOWNLOAD METHOD--%
-p.download(file_owner, file_id);
-
-%-------------------------------------------------------------------------%
+ %--CONSTRUCT PLOTLY FIGURE OBJECT--%
+ p = plotlyfig('Visible','off');
+ %--MAKE CALL TO DOWNLOAD METHOD--%
+ p.download(file_owner, file_id);
end
diff --git a/plotly/plotly_aux/checkescape.m b/plotly/plotly_aux/checkescape.m
index deecbd4a..c118df7c 100644
--- a/plotly/plotly_aux/checkescape.m
+++ b/plotly/plotly_aux/checkescape.m
@@ -1,20 +1,20 @@
function escaped_val = checkescape(val)
-%adds '\' escape character if needed
-ec = '\';
-ind = find( (val == '"') | (val == '\' ) | (val == '/' ));
-if(ind)
- if(ind(1) == 1)
- val = ['\' val];
- ind = ind + 1;
- ind(1) = [];
- end
- if (ind)
- val = [val ec(ones(1,length(ind)))]; %extend lengh of val to prep for char shifts.
- for i = 1:length(ind)
- val(ind(i):end) = [ec val(ind(i):end-1)];
- ind = ind+1;
+ %adds '\' escape character if needed
+ ec = '\';
+ ind = find( (val == '"') | (val == '\' ) | (val == '/' ));
+ if ind
+ if ind(1) == 1
+ val = ['\' val];
+ ind = ind + 1;
+ ind(1) = [];
+ end
+ if ind
+ val = [val ec(ones(1,length(ind)))]; %extend lengh of val to prep for char shifts.
+ for i = 1:length(ind)
+ val(ind(i):end) = [ec val(ind(i):end-1)];
+ ind = ind+1;
+ end
end
end
+ escaped_val = val;
end
-
-escaped_val = val;
\ No newline at end of file
diff --git a/plotly/plotly_aux/getuserdir.m b/plotly/plotly_aux/getuserdir.m
index 844f0ab3..0f08c4a7 100644
--- a/plotly/plotly_aux/getuserdir.m
+++ b/plotly/plotly_aux/getuserdir.m
@@ -1,13 +1,14 @@
-function userDir = getuserdir
-% GETUSERDIR Retrieve the user directory
-% - Under Windows returns the %APPDATA% directory
-% - For other OSs uses java to retrieve the user.home directory
-
-if ispc
- % userDir = winqueryreg('HKEY_CURRENT_USER',...
- % ['Software\Microsoft\Windows\CurrentVersion\' ...
- % 'Explorer\Shell Folders'],'Personal');
- userDir = getenv('appdata');
-else
- userDir = char(java.lang.System.getProperty('user.home'));
-end
\ No newline at end of file
+function userDir = getuserdir
+ % GETUSERDIR Retrieve the user directory
+ % - Under Windows returns the %APPDATA% directory
+ % - For other OSs uses java to retrieve the user.home directory
+
+ if ispc
+ % userDir = winqueryreg('HKEY_CURRENT_USER',...
+ % ['Software\Microsoft\Windows\CurrentVersion\' ...
+ % 'Explorer\Shell Folders'],'Personal');
+ userDir = getenv('appdata');
+ else
+ userDir = char(java.lang.System.getProperty('user.home'));
+ end
+end
diff --git a/plotly/plotly_aux/makecall.m b/plotly/plotly_aux/makecall.m
index eda56e1c..4a525dcd 100644
--- a/plotly/plotly_aux/makecall.m
+++ b/plotly/plotly_aux/makecall.m
@@ -1,5 +1,4 @@
function st = makecall(args, origin, structargs)
-
% check if signed in and grab username, key, domain
[un, key, domain] = signin;
if isempty(un) || isempty(key)
@@ -17,7 +16,9 @@
args = m2json(args);
kwargs = m2json(structargs);
url = [domain '/clientresp'];
- payload = {'platform', platform, 'version', plotly_version, 'args', args, 'un', un, 'key', key, 'origin', origin, 'kwargs', kwargs};
+ payload = {'platform', platform, 'version', plotly_version, ...
+ 'args', args, 'un', un, 'key', key, 'origin', origin, ...
+ 'kwargs', kwargs};
if (is_octave)
% use octave super_powers
@@ -28,7 +29,5 @@
end
st = jsondecode(resp);
-
response_handler(resp);
-
-end
\ No newline at end of file
+end
diff --git a/plotly/plotly_aux/plotly.m b/plotly/plotly_aux/plotly.m
index c8c37bfc..12a275a1 100644
--- a/plotly/plotly_aux/plotly.m
+++ b/plotly/plotly_aux/plotly.m
@@ -1,69 +1,68 @@
function [response] = plotly(varargin)
-% plotly - create a graph in your plotly account
-% [response] = plotly(x1,y1,x2,y2,..., kwargs)
-% [response] = plotly({data1, data2, ...}, kwargs)
-% x1,y1 - arrays
-% data1 - a data struct with styling information
-% kwargs - an optional argument struct
-%
-% See also plotlylayout, plotlystyle, signin, signup
-%
-% For full documentation and examples, see https://plot.ly/api
-origin = 'plot';
-offline_given = true;
-writeFile=true;
+ % plotly - create a graph in your plotly account
+ % [response] = plotly(x1,y1,x2,y2,..., kwargs)
+ % [response] = plotly({data1, data2, ...}, kwargs)
+ % x1,y1 - arrays
+ % data1 - a data struct with styling information
+ % kwargs - an optional argument struct
+ %
+ % See also plotlylayout, plotlystyle, signin, signup
+ %
+ % For full documentation and examples, see https://plot.ly/api
+ origin = 'plot';
+ offline_given = true;
+ writeFile = true;
-if isstruct(varargin{end})
- structargs = varargin{end};
- f = fieldnames(structargs);
-
- idx = cellfun(@(x) strcmpi(x,'offline'), f);
- if sum(idx)==1
- offline = structargs.(f{idx});
- offline_given = offline;
- else
- offline = true;
- offline_given = offline;
- end
+ if isstruct(varargin{end})
+ structargs = varargin{end};
+ f = fieldnames(structargs);
+
+ idx = cellfun(@(x) strcmpi(x, 'offline'), f);
+ if sum(idx) == 1
+ offline = structargs.(f{idx});
+ offline_given = offline;
+ else
+ offline = true;
+ offline_given = offline;
+ end
- if ~any(strcmp('filename',lower(f)))
- if offline
- structargs.filename = 'untitled';
+ if ~any(strcmpi('filename', f))
+ if offline
+ structargs.filename = 'untitled';
+ else
+ structargs.filename = NaN;
+ end
+ end
+ if ~any(strcmpi('fileopt',f))
+ structargs.fileopt = NaN;
+ end
+
+ idx = cellfun(@(x) strcmpi(x, 'writefile'),f);
+ if sum(idx) == 1
+ writeFile=structargs.(f{idx});
+ end
+
+ args = varargin(1:(end-1));
+
+ else
+ if offline_given
+ structargs = struct('filename', 'untitled', 'fileopt', NaN);
else
- structargs.filename = NaN;
+ structargs = struct('filename', NaN, 'fileopt', NaN);
end
+ args = varargin(1:end);
end
- if ~any(strcmp('fileopt',lower(f)))
- structargs.fileopt = NaN;
- end
-
- idx = cellfun(@(x) strcmpi(x,'writefile'),f);
- if sum(idx)==1
- writeFile=structargs.(f{idx});
+
+ if ~writeFile
+ offline_given = true;
end
-
- args = varargin(1:(end-1));
-
-else
+
if offline_given
- structargs = struct('filename', 'untitled', 'fileopt', NaN);
+ obj = plotlyfig(args, structargs);
+ obj.layout.width = 840;
+ obj.layout.height = 630;
+ response = obj.plotly;
else
- structargs = struct('filename', NaN, 'fileopt', NaN);
+ response = makecall(args, origin, structargs);
end
- args = varargin(1:end);
end
-
-if ~writeFile
- offline_given = true;
-end
-
-if offline_given
- obj = plotlyfig(args, structargs);
- obj.layout.width = 840;
- obj.layout.height = 630;
- response = obj.plotly;
-else
- response = makecall(args, origin, structargs);
-end
-
-end
\ No newline at end of file
diff --git a/plotly/plotly_aux/plotlygenimage.m b/plotly/plotly_aux/plotlygenimage.m
index fd1dc0da..1bcf5ef8 100644
--- a/plotly/plotly_aux/plotlygenimage.m
+++ b/plotly/plotly_aux/plotlygenimage.m
@@ -1,5 +1,4 @@
function plotlygenimage(figure_or_data, filename, varargin)
-
[pathstr, name, ext] = fileparts(filename);
if nargin < 3
format = ext(2:length(ext));
@@ -10,9 +9,9 @@ function plotlygenimage(figure_or_data, filename, varargin)
if (strcmp(ext,'') && nargin < 3)
filename = [filename, '.png'];
format = 'png';
- elseif( ~strcmp(ext, '') && nargin < 3)
+ elseif ( ~strcmp(ext, '') && nargin < 3)
format = ext(2:length(ext));
- elseif(strcmp(ext,'') && nargin==3)
+ elseif (strcmp(ext,'') && nargin==3)
filename = [filename, '.', varargin{1}];
else
filename = [filename, '.', varargin{1}];
@@ -50,10 +49,11 @@ function plotlygenimage(figure_or_data, filename, varargin)
'MATLAB'
});
% return the response as bytes -
- % convert the bytes to unicode chars if the response fails or isn't (pdf, png, or jpeg)
- % ... gnarly!
- [response_string, extras] = urlread2(url, 'Post', payload, headers, 'CAST_OUTPUT', false);
- if( extras.status.value ~= 200 || ...
+ % convert the bytes to unicode chars if the response fails or isn't
+ % (pdf, png, or jpeg) ... gnarly!
+ [response_string, extras] = urlread2(url, 'Post', payload, headers, ...
+ 'CAST_OUTPUT', false);
+ if ( extras.status.value ~= 200 || ...
~(strcmp(extras.allHeaders.Content_Type, 'image/jpeg') || ...
strcmp(extras.allHeaders.Content_Type, 'image/png') || ...
strcmp(extras.allHeaders.Content_Type, 'application/pdf')))
diff --git a/plotly/plotly_aux/plotlygetfile.m b/plotly/plotly_aux/plotlygetfile.m
index 9f9dc9d6..dabd45a8 100644
--- a/plotly/plotly_aux/plotlygetfile.m
+++ b/plotly/plotly_aux/plotlygetfile.m
@@ -1,5 +1,4 @@
function figure = plotlygetfile(file_owner, file_id)
-
[un, key, domain] = signin;
headers = struct(...
diff --git a/plotly/plotly_aux/response_handler.m b/plotly/plotly_aux/response_handler.m
index 47a16883..e7d7b456 100644
--- a/plotly/plotly_aux/response_handler.m
+++ b/plotly/plotly_aux/response_handler.m
@@ -1,7 +1,7 @@
function response_handler(response_body, varargin)
% varargin is the optional `extras` struct
% returned by urlread2
- if(length(varargin)==1)
+ if (length(varargin)==1)
extras = varargin{1};
if (strcmp(extras.allHeaders.Content_Type, 'image/jpeg') || ...
strcmp(extras.allHeaders.Content_Type, 'image/png') || ...
@@ -13,29 +13,29 @@ function response_handler(response_body, varargin)
response_struct = jsondecode(response_body);
- if(isempty(fieldnames(response_struct)))
+ if (isempty(fieldnames(response_struct)))
error(['Unexpected Response: ', response_body])
end
f = fieldnames(response_struct);
if ((any(strcmp(f, 'error')) && (~isempty(response_struct.error))) || ...
- (length(varargin)==1 && varargin{1}.status.value ~= 200))
+ (length(varargin) == 1 && varargin{1}.status.value ~= 200))
% If the error string is nonempty
% then check the `extras`
% object for a status code
% and embed that in the response
- if(length(varargin)==1)
+ if (length(varargin)==1)
extras = varargin{1};
- error(['BadResponse:StatusCode',num2str(extras.status.value)], response_struct.error)
+ error(['BadResponse:StatusCode', ...
+ num2str(extras.status.value)], response_struct.error)
else
error(response_struct.error)
end
end
- if any(strcmp(f,'warning'))
+ if any(strcmp(f, 'warning'))
fprintf(response_struct.warning)
end
- if any(strcmp(f,'message'))
+ if any(strcmp(f, 'message'))
fprintf(response_struct.message)
end
-
end
diff --git a/plotly/plotly_aux/struct2json.m b/plotly/plotly_aux/struct2json.m
index 6555a7f0..0fb67692 100644
--- a/plotly/plotly_aux/struct2json.m
+++ b/plotly/plotly_aux/struct2json.m
@@ -2,4 +2,4 @@
f = fieldnames(s);
strList = cellfun(@(x) sprintf('"%s" : %s', x, m2json(s.(x))), f, un=0);
str = sprintf("{%s}", strjoin(strList, ", "));
-end
\ No newline at end of file
+end
diff --git a/plotly/plotly_aux/urlread2/http_createHeader.m b/plotly/plotly_aux/urlread2/http_createHeader.m
index 457be94f..0e80241f 100755
--- a/plotly/plotly_aux/urlread2/http_createHeader.m
+++ b/plotly/plotly_aux/urlread2/http_createHeader.m
@@ -1,11 +1,11 @@
-function header = http_createHeader(name,value)
-%http_createHeader Simple function for creating input header to urlread2
-%
-% header = http_createHeader(name,value)
-%
-% CODE: header = struct('name',name,'value',value);
-%
-% See Also:
-% urlread2
-
+function header = http_createHeader(name,value)
+%http_createHeader Simple function for creating input header to urlread2
+%
+% header = http_createHeader(name,value)
+%
+% CODE: header = struct('name',name,'value',value);
+%
+% See Also:
+% urlread2
+
header = struct('name',name,'value',value);
\ No newline at end of file
diff --git a/plotly/plotly_aux/urlread2/http_paramsToString.m b/plotly/plotly_aux/urlread2/http_paramsToString.m
index f9bc490c..376a0fa1 100755
--- a/plotly/plotly_aux/urlread2/http_paramsToString.m
+++ b/plotly/plotly_aux/urlread2/http_paramsToString.m
@@ -1,62 +1,62 @@
-function [str,header] = http_paramsToString(params,encodeOption)
-%http_paramsToString Creates string for a POST or GET requests
-%
-% [queryString,header] = http_paramsToString(params, *encodeOption)
-%
-% INPUTS
-% =======================================================================
-% params: cell array of property/value pairs
-% NOTE: If the input is in a 2 column matrix, then first column
-% entries are properties and the second column entries are
-% values, however this is NOT necessary (generally linear)
-% encodeOption: (default 1)
-% 1 - the typical URL encoding scheme (Java call)
-%
-% OUTPUTS
-% =======================================================================
-% queryString: querystring to add onto URL (LACKS "?", see example)
-% header : the header that should be attached for post requests when
-% using urlread2
-%
-% EXAMPLE:
-% ==============================================================
-% params = {'cmd' 'search' 'db' 'pubmed' 'term' 'wtf batman'};
-% queryString = http_paramsToString(params);
-% queryString => cmd=search&db=pubmed&term=wtf+batman
-%
-% IMPORTANT: This function does not filter parameters, sort them,
-% or remove empty inputs (if necessary), this must be done before hand
-
-if ~exist('encodeOption','var')
- encodeOption = 1;
-end
-
-if size(params,2) == 2 && size(params,1) > 1
- params = params';
- params = params(:);
-end
-
-str = '';
-for i=1:2:length(params)
- if (i == 1), separator = ''; else separator = '&'; end
- switch encodeOption
- case 1
- param = urlencode(params{i});
- value = urlencode(params{i+1});
-% case 2
-% param = oauth.percentEncodeString(params{i});
-% value = oauth.percentEncodeString(params{i+1});
-% header = http_getContentTypeHeader(1);
- otherwise
- error('Case not used')
- end
- str = [str separator param '=' value]; %#ok
-end
-
-switch encodeOption
- case 1
- header = http_createHeader('Content-Type','application/x-www-form-urlencoded');
-end
-
-
+function [str,header] = http_paramsToString(params,encodeOption)
+%http_paramsToString Creates string for a POST or GET requests
+%
+% [queryString,header] = http_paramsToString(params, *encodeOption)
+%
+% INPUTS
+% =======================================================================
+% params: cell array of property/value pairs
+% NOTE: If the input is in a 2 column matrix, then first column
+% entries are properties and the second column entries are
+% values, however this is NOT necessary (generally linear)
+% encodeOption: (default 1)
+% 1 - the typical URL encoding scheme (Java call)
+%
+% OUTPUTS
+% =======================================================================
+% queryString: querystring to add onto URL (LACKS "?", see example)
+% header : the header that should be attached for post requests when
+% using urlread2
+%
+% EXAMPLE:
+% ==============================================================
+% params = {'cmd' 'search' 'db' 'pubmed' 'term' 'wtf batman'};
+% queryString = http_paramsToString(params);
+% queryString => cmd=search&db=pubmed&term=wtf+batman
+%
+% IMPORTANT: This function does not filter parameters, sort them,
+% or remove empty inputs (if necessary), this must be done before hand
+
+if ~exist('encodeOption','var')
+ encodeOption = 1;
+end
+
+if size(params,2) == 2 && size(params,1) > 1
+ params = params';
+ params = params(:);
+end
+
+str = '';
+for i=1:2:length(params)
+ if (i == 1), separator = ''; else separator = '&'; end
+ switch encodeOption
+ case 1
+ param = urlencode(params{i});
+ value = urlencode(params{i+1});
+% case 2
+% param = oauth.percentEncodeString(params{i});
+% value = oauth.percentEncodeString(params{i+1});
+% header = http_getContentTypeHeader(1);
+ otherwise
+ error('Case not used')
+ end
+ str = [str separator param '=' value]; %#ok
+end
+
+switch encodeOption
+ case 1
+ header = http_createHeader('Content-Type','application/x-www-form-urlencoded');
+end
+
+
end
\ No newline at end of file
diff --git a/plotly/plotly_aux/urlread2/urlread2.m b/plotly/plotly_aux/urlread2/urlread2.m
index 53ba8ca6..b552861c 100755
--- a/plotly/plotly_aux/urlread2/urlread2.m
+++ b/plotly/plotly_aux/urlread2/urlread2.m
@@ -1,371 +1,371 @@
-function [output,extras] = urlread2(urlChar,method,body,headersIn,varargin)
-%urlread2 Makes HTTP requests and processes response
-%
-% [output,extras] = urlread2(urlChar, *method, *body, *headersIn, varargin)
-%
-% * indicates optional inputs that must be entered in place
-%
-% UNDOCUMENTED MATLAB VERSION
-%
-% EXAMPLE CALLING FORMS
-% ... = urlread2(urlChar)
-% ... = urlread2(urlChar,'GET','',[],prop1,value1,prop2,value2,etc)
-% ... = urlread2(urlChar,'POST',body,headers)
-%
-% FEATURES
-% =======================================================================
-% 1) Allows specification of any HTTP method
-% 2) Allows specification of any header. Very little is hard-coded
-% in for header handling.
-% 3) Returns response status and headers
-% 4) Should handle unicode properly ...
-%
-% OUTPUTS
-% =======================================================================
-% output : body of the response, either text or binary depending upon
-% CAST_OUTPUT property
-% extras : (structure)
-% .allHeaders - stucture, fields have cellstr values, HTTP headers may
-% may be repeated but will have a single field entry, with each
-% repeat's value another being another entry in the cellstr, for
-% example:
-% .Set_Cookie = {'first_value' 'second_value'}
-% .firstHeaders - (structure), variable fields, contains the first
-% string entry for each field in allHeaders, this
-% structure can be used to avoid dereferencing a cell
-% for fields you expect not to be repeated ...
-% EXAMPLE:
-% .Response : 'HTTP/1.1 200 OK'}
-% .Server : 'nginx'
-% .Date : 'Tue, 29 Nov 2011 02:23:16 GMT'
-% .Content_Type : 'text/html; charset=UTF-8'
-% .Content_Length : '109155'
-% .Connection : 'keep-alive'
-% .Vary : 'Accept-Encoding, User-Agent'
-% .Cache_Control : 'max-age=60, private'
-% .Set_Cookie : 'first_value'
-% .status - (structure)
-% .value : numeric value of status, ex. 200
-% .msg : message that goes along with status, ex. 'OK'
-% .url - eventual url that led to output, this can change from
-% the input with redirects, see FOLLOW_REDIRECTS
-% .isGood - (logical) I believe this is an indicator of the presence of 400
-% or 500 status codes (see status.value) but more
-% testing is needed. In other words, true if status.value < 400.
-% In code, set true if the response was obtainable without
-% resorting to checking the error stream.
-%
-% INPUTS
-% =======================================================================
-% urlChar : The full url, must include scheme (http, https)
-% method : examples: 'GET' 'POST' etc
-% body : (vector)(char, uint8 or int8) body to write, generally used
-% with POST or PUT, use of uint8 or int8 ensures that the
-% body input is not manipulated before sending, char is sent
-% via unicode2native function with ENCODING input (see below)
-% headersIn : (structure array), use empty [] or '' if no headers are needed
-% but varargin property/value pairs are, multiple headers
-% may be passed in as a structure array
-% .name - (string), name of the header, a name property is used
-% instead of a field because the name must match a valid
-% header
-% .value - (string), value to use
-%
-% OPTIONAL INPUTS (varargin, property/value pairs)
-% =======================================================================
-% CAST_OUTPUT : (default true) output is uint8, useful if the body
-% of the response is not text
-% ENCODING : (default ''), ENCODING input to function unicode2native
-% FOLLOW_REDIRECTS : (default true), if false 3xx status codes will
-% be returned and need to be handled by the user,
-% note this does not handle javascript or meta tag
-% redirects, just server based ones
-% READ_TIMEOUT : (default 0), 0 means no timeout, value is in
-% milliseconds
-%
-% EXAMPLES
-% =======================================================================
-% GET:
-% --------------------------------------------
-% url = 'http://www.mathworks.com/matlabcentral/fileexchange/';
-% query = 'urlread2';
-% params = {'term' query};
-% queryString = http_paramsToString(params,1);
-% url = [url '?' queryString];
-% [output,extras] = urlread2(url);
-%
-% POST:
-% --------------------------------------------
-% url = 'http://posttestserver.com/post.php';
-% params = {'testChars' char([2500 30000]) 'new code' '?'};
-% [paramString,header] = http_paramsToString(params,1);
-% [output,extras] = urlread2(url,'POST',paramString,header);
-%
-% From behind a firewall, use the Preferences to set your proxy server.
-%
-% See Also:
-% http_paramsToString
-% unicode2native
-% native2unicode
-%
-% Subfunctions:
-% fixHeaderCasing - small subfunction to fix case errors encountered in real
-% world, requires updating when casing doesn't match expected form, like
-% if someone sent the header content-Encoding instead of
-% Content-Encoding
-%
-% Based on original urlread code by Matthew J. Simoneau
-%
-% VERSION = 1.1
-
-in.CAST_OUTPUT = true;
-in.FOLLOW_REDIRECTS = true;
-in.READ_TIMEOUT = 0;
-in.ENCODING = '';
-
-%Input handling
-%---------------------------------------
-if ~isempty(varargin)
- for i = 1:2:numel(varargin)
- prop = upper(varargin{i});
- value = varargin{i+1};
- if isfield(in,prop)
- in.(prop) = value;
- else
- error('Unrecognized input to function: %s',prop)
- end
- end
-end
-
-if ~exist('method','var') || isempty(method), method = 'GET'; end
-if ~exist('body','var'), body = ''; end
-if ~exist('headersIn','var'), headersIn = []; end
-
-assert(usejava('jvm'),'Function requires Java')
-
-import com.mathworks.mlwidgets.io.InterruptibleStreamCopier;
-com.mathworks.mlwidgets.html.HTMLPrefs.setProxySettings %Proxy settings need to be set
-
-%Create a urlConnection.
-%-----------------------------------
-urlConnection = getURLConnection(urlChar);
-%For HTTP uses sun.net.www.protocol.http.HttpURLConnection
-%Might use ice.net.HttpURLConnection but this has more overhead
-
-%SETTING PROPERTIES
-%-------------------------------------------------------
-urlConnection.setRequestMethod(upper(method));
-urlConnection.setFollowRedirects(in.FOLLOW_REDIRECTS);
-urlConnection.setReadTimeout(in.READ_TIMEOUT);
-
-for iHeader = 1:length(headersIn)
- curHeader = headersIn(iHeader);
- urlConnection.setRequestProperty(curHeader.name,curHeader.value);
-end
-
-if ~isempty(body)
- %Ensure vector?
- if size(body,1) > 1
- if size(body,2) > 1
- error('Input parameter to function: body, must be a vector')
- else
- body = body';
- end
- end
-
- if ischar(body)
- %NOTE: '' defaults to Matlab's default encoding scheme
- body = unicode2native(body,in.ENCODING);
- elseif ~(strcmp(class(body),'uint8') || strcmp(class(body),'int8'))
- error('Function input: body, should be of class char, uint8, or int8, detected: %s',class(body))
- end
-
- urlConnection.setRequestProperty('Content-Length',int2str(length(body)));
- urlConnection.setDoOutput(true);
- outputStream = urlConnection.getOutputStream;
- outputStream.write(body);
- outputStream.close;
-else
- urlConnection.setRequestProperty('Content-Length','0');
-end
-
-%==========================================================================
-% Read the data from the connection.
-%==========================================================================
-%This should be done first because it tells us if things are ok or not
-%NOTE: If there is an error, functions below using urlConnection, notably
-%getResponseCode, will fail as well
-try
- inputStream = urlConnection.getInputStream;
- isGood = true;
-catch ME
- isGood = false;
-%NOTE: HTTP error codes will throw an error here, we'll allow those for now
-%We might also get another error in which case the inputStream will be
-%undefined, those we will throw here
- inputStream = urlConnection.getErrorStream;
-
- if isempty(inputStream)
- msg = ME.message;
- I = strfind(msg,char([13 10 9])); %see example by setting timeout to 1
- %Should remove the barf of the stack, at ... at ... at ... etc
- %Likely that this could be improved ... (generate link with full msg)
- if ~isempty(I)
- msg = msg(1:I(1)-1);
- end
- fprintf(2,'Response stream is undefined\n below is a Java Error dump (truncated):\n');
- error(msg)
- end
-end
-
-%POPULATING HEADERS
-%--------------------------------------------------------------------------
-allHeaders = struct;
-allHeaders.Response = {char(urlConnection.getHeaderField(0))};
-done = false;
-headerIndex = 0;
-
-while ~done
- headerIndex = headerIndex + 1;
- headerValue = char(urlConnection.getHeaderField(headerIndex));
- if ~isempty(headerValue)
- headerName = char(urlConnection.getHeaderFieldKey(headerIndex));
- headerName = fixHeaderCasing(headerName); %NOT YET FINISHED
-
- %Important, for name safety all hyphens are replace with underscores
- headerName(headerName == '-') = '_';
- if isfield(allHeaders,headerName)
- allHeaders.(headerName) = [allHeaders.(headerName) headerValue];
- else
- allHeaders.(headerName) = {headerValue};
- end
- else
- done = true;
- end
-end
-
-firstHeaders = struct;
-fn = fieldnames(allHeaders);
-for iHeader = 1:length(fn)
- curField = fn{iHeader};
- firstHeaders.(curField) = allHeaders.(curField){1};
-end
-
-status = struct(...
- 'value', urlConnection.getResponseCode(),...
- 'msg', char(urlConnection.getResponseMessage));
-
-%PROCESSING OF OUTPUT
-%----------------------------------------------------------
-byteArrayOutputStream = java.io.ByteArrayOutputStream;
-% This StreamCopier is unsupported and may change at any time. OH GREAT :/
-isc = InterruptibleStreamCopier.getInterruptibleStreamCopier;
-isc.copyStream(inputStream,byteArrayOutputStream);
-inputStream.close;
-byteArrayOutputStream.close;
-
-if in.CAST_OUTPUT
- charset = '';
-
- %Extraction of character set from Content-Type header if possible
- if isfield(firstHeaders,'Content_Type')
- text = firstHeaders.Content_Type;
- %Always open to regexp improvements
- charset = regexp(text,'(?<=charset=)[^\s]*','match','once');
- end
-
- if ~isempty(charset)
- output = native2unicode(typecast(byteArrayOutputStream.toByteArray','uint8'),charset);
- else
- output = char(typecast(byteArrayOutputStream.toByteArray','uint8'));
- end
-else
- %uint8 is more useful for later charecter conversions
- %uint8 or int8 is somewhat arbitary at this point
- output = typecast(byteArrayOutputStream.toByteArray','uint8');
-end
-
-extras = struct;
-extras.allHeaders = allHeaders;
-extras.firstHeaders = firstHeaders;
-extras.status = status;
-%Gets eventual url even with redirection
-extras.url = char(urlConnection.getURL);
-extras.isGood = isGood;
-
-
-
-end
-
-function headerNameOut = fixHeaderCasing(headerName)
-%fixHeaderCasing Forces standard casing of headers
-%
-% headerNameOut = fixHeaderCasing(headerName)
-%
-% This is important for field access in a structure which
-% is case sensitive
-%
-% Not yet finished.
-% I've been adding to this function as problems come along
-
- switch lower(headerName)
- case 'location'
- headerNameOut = 'Location';
- case 'content_type'
- headerNameOut = 'Content_Type';
- otherwise
- headerNameOut = headerName;
- end
-end
-
-%==========================================================================
-%==========================================================================
-%==========================================================================
-
-function urlConnection = getURLConnection(urlChar)
-%getURLConnection
-%
-% urlConnection = getURLConnection(urlChar)
-
-% Determine the protocol (before the ":").
-protocol = urlChar(1:find(urlChar==':',1)-1);
-
-
-% Try to use the native handler, not the ice.* classes.
-try
- switch protocol
- case 'http'
- %http://www.docjar.com/docs/api/sun/net/www/protocol/http/HttpURLConnection.html
- handler = sun.net.www.protocol.http.Handler;
- case 'https'
- handler = sun.net.www.protocol.https.Handler;
- end
-catch ME
- handler = [];
-end
-
-% Create the URL object.
-try
- if isempty(handler)
- url = java.net.URL(urlChar);
- else
- url = java.net.URL([],urlChar,handler);
- end
-catch ME
- error('Failure to parse URL or protocol not supported for:\nURL: %s',urlChar);
-end
-
-% Get the proxy information using MathWorks facilities for unified proxy
-% preference settings.
-mwtcp = com.mathworks.net.transport.MWTransportClientPropertiesFactory.create();
-proxy = mwtcp.getProxy();
-
-% Open a connection to the URL.
-if isempty(proxy)
- urlConnection = url.openConnection;
-else
- urlConnection = url.openConnection(proxy);
-end
-
-
-end
+function [output,extras] = urlread2(urlChar,method,body,headersIn,varargin)
+%urlread2 Makes HTTP requests and processes response
+%
+% [output,extras] = urlread2(urlChar, *method, *body, *headersIn, varargin)
+%
+% * indicates optional inputs that must be entered in place
+%
+% UNDOCUMENTED MATLAB VERSION
+%
+% EXAMPLE CALLING FORMS
+% ... = urlread2(urlChar)
+% ... = urlread2(urlChar,'GET','',[],prop1,value1,prop2,value2,etc)
+% ... = urlread2(urlChar,'POST',body,headers)
+%
+% FEATURES
+% =======================================================================
+% 1) Allows specification of any HTTP method
+% 2) Allows specification of any header. Very little is hard-coded
+% in for header handling.
+% 3) Returns response status and headers
+% 4) Should handle unicode properly ...
+%
+% OUTPUTS
+% =======================================================================
+% output : body of the response, either text or binary depending upon
+% CAST_OUTPUT property
+% extras : (structure)
+% .allHeaders - stucture, fields have cellstr values, HTTP headers may
+% may be repeated but will have a single field entry, with each
+% repeat's value another being another entry in the cellstr, for
+% example:
+% .Set_Cookie = {'first_value' 'second_value'}
+% .firstHeaders - (structure), variable fields, contains the first
+% string entry for each field in allHeaders, this
+% structure can be used to avoid dereferencing a cell
+% for fields you expect not to be repeated ...
+% EXAMPLE:
+% .Response : 'HTTP/1.1 200 OK'}
+% .Server : 'nginx'
+% .Date : 'Tue, 29 Nov 2011 02:23:16 GMT'
+% .Content_Type : 'text/html; charset=UTF-8'
+% .Content_Length : '109155'
+% .Connection : 'keep-alive'
+% .Vary : 'Accept-Encoding, User-Agent'
+% .Cache_Control : 'max-age=60, private'
+% .Set_Cookie : 'first_value'
+% .status - (structure)
+% .value : numeric value of status, ex. 200
+% .msg : message that goes along with status, ex. 'OK'
+% .url - eventual url that led to output, this can change from
+% the input with redirects, see FOLLOW_REDIRECTS
+% .isGood - (logical) I believe this is an indicator of the presence of 400
+% or 500 status codes (see status.value) but more
+% testing is needed. In other words, true if status.value < 400.
+% In code, set true if the response was obtainable without
+% resorting to checking the error stream.
+%
+% INPUTS
+% =======================================================================
+% urlChar : The full url, must include scheme (http, https)
+% method : examples: 'GET' 'POST' etc
+% body : (vector)(char, uint8 or int8) body to write, generally used
+% with POST or PUT, use of uint8 or int8 ensures that the
+% body input is not manipulated before sending, char is sent
+% via unicode2native function with ENCODING input (see below)
+% headersIn : (structure array), use empty [] or '' if no headers are needed
+% but varargin property/value pairs are, multiple headers
+% may be passed in as a structure array
+% .name - (string), name of the header, a name property is used
+% instead of a field because the name must match a valid
+% header
+% .value - (string), value to use
+%
+% OPTIONAL INPUTS (varargin, property/value pairs)
+% =======================================================================
+% CAST_OUTPUT : (default true) output is uint8, useful if the body
+% of the response is not text
+% ENCODING : (default ''), ENCODING input to function unicode2native
+% FOLLOW_REDIRECTS : (default true), if false 3xx status codes will
+% be returned and need to be handled by the user,
+% note this does not handle javascript or meta tag
+% redirects, just server based ones
+% READ_TIMEOUT : (default 0), 0 means no timeout, value is in
+% milliseconds
+%
+% EXAMPLES
+% =======================================================================
+% GET:
+% --------------------------------------------
+% url = 'http://www.mathworks.com/matlabcentral/fileexchange/';
+% query = 'urlread2';
+% params = {'term' query};
+% queryString = http_paramsToString(params,1);
+% url = [url '?' queryString];
+% [output,extras] = urlread2(url);
+%
+% POST:
+% --------------------------------------------
+% url = 'http://posttestserver.com/post.php';
+% params = {'testChars' char([2500 30000]) 'new code' '?'};
+% [paramString,header] = http_paramsToString(params,1);
+% [output,extras] = urlread2(url,'POST',paramString,header);
+%
+% From behind a firewall, use the Preferences to set your proxy server.
+%
+% See Also:
+% http_paramsToString
+% unicode2native
+% native2unicode
+%
+% Subfunctions:
+% fixHeaderCasing - small subfunction to fix case errors encountered in real
+% world, requires updating when casing doesn't match expected form, like
+% if someone sent the header content-Encoding instead of
+% Content-Encoding
+%
+% Based on original urlread code by Matthew J. Simoneau
+%
+% VERSION = 1.1
+
+in.CAST_OUTPUT = true;
+in.FOLLOW_REDIRECTS = true;
+in.READ_TIMEOUT = 0;
+in.ENCODING = '';
+
+%Input handling
+%---------------------------------------
+if ~isempty(varargin)
+ for i = 1:2:numel(varargin)
+ prop = upper(varargin{i});
+ value = varargin{i+1};
+ if isfield(in,prop)
+ in.(prop) = value;
+ else
+ error('Unrecognized input to function: %s',prop)
+ end
+ end
+end
+
+if ~exist('method','var') || isempty(method), method = 'GET'; end
+if ~exist('body','var'), body = ''; end
+if ~exist('headersIn','var'), headersIn = []; end
+
+assert(usejava('jvm'),'Function requires Java')
+
+import com.mathworks.mlwidgets.io.InterruptibleStreamCopier;
+com.mathworks.mlwidgets.html.HTMLPrefs.setProxySettings %Proxy settings need to be set
+
+%Create a urlConnection.
+%-----------------------------------
+urlConnection = getURLConnection(urlChar);
+%For HTTP uses sun.net.www.protocol.http.HttpURLConnection
+%Might use ice.net.HttpURLConnection but this has more overhead
+
+%SETTING PROPERTIES
+%-------------------------------------------------------
+urlConnection.setRequestMethod(upper(method));
+urlConnection.setFollowRedirects(in.FOLLOW_REDIRECTS);
+urlConnection.setReadTimeout(in.READ_TIMEOUT);
+
+for iHeader = 1:length(headersIn)
+ curHeader = headersIn(iHeader);
+ urlConnection.setRequestProperty(curHeader.name,curHeader.value);
+end
+
+if ~isempty(body)
+ %Ensure vector?
+ if size(body,1) > 1
+ if size(body,2) > 1
+ error('Input parameter to function: body, must be a vector')
+ else
+ body = body';
+ end
+ end
+
+ if ischar(body)
+ %NOTE: '' defaults to Matlab's default encoding scheme
+ body = unicode2native(body,in.ENCODING);
+ elseif ~(strcmp(class(body),'uint8') || strcmp(class(body),'int8'))
+ error('Function input: body, should be of class char, uint8, or int8, detected: %s',class(body))
+ end
+
+ urlConnection.setRequestProperty('Content-Length',int2str(length(body)));
+ urlConnection.setDoOutput(true);
+ outputStream = urlConnection.getOutputStream;
+ outputStream.write(body);
+ outputStream.close;
+else
+ urlConnection.setRequestProperty('Content-Length','0');
+end
+
+%==========================================================================
+% Read the data from the connection.
+%==========================================================================
+%This should be done first because it tells us if things are ok or not
+%NOTE: If there is an error, functions below using urlConnection, notably
+%getResponseCode, will fail as well
+try
+ inputStream = urlConnection.getInputStream;
+ isGood = true;
+catch ME
+ isGood = false;
+%NOTE: HTTP error codes will throw an error here, we'll allow those for now
+%We might also get another error in which case the inputStream will be
+%undefined, those we will throw here
+ inputStream = urlConnection.getErrorStream;
+
+ if isempty(inputStream)
+ msg = ME.message;
+ I = strfind(msg,char([13 10 9])); %see example by setting timeout to 1
+ %Should remove the barf of the stack, at ... at ... at ... etc
+ %Likely that this could be improved ... (generate link with full msg)
+ if ~isempty(I)
+ msg = msg(1:I(1)-1);
+ end
+ fprintf(2,'Response stream is undefined\n below is a Java Error dump (truncated):\n');
+ error(msg)
+ end
+end
+
+%POPULATING HEADERS
+%--------------------------------------------------------------------------
+allHeaders = struct;
+allHeaders.Response = {char(urlConnection.getHeaderField(0))};
+done = false;
+headerIndex = 0;
+
+while ~done
+ headerIndex = headerIndex + 1;
+ headerValue = char(urlConnection.getHeaderField(headerIndex));
+ if ~isempty(headerValue)
+ headerName = char(urlConnection.getHeaderFieldKey(headerIndex));
+ headerName = fixHeaderCasing(headerName); %NOT YET FINISHED
+
+ %Important, for name safety all hyphens are replace with underscores
+ headerName(headerName == '-') = '_';
+ if isfield(allHeaders,headerName)
+ allHeaders.(headerName) = [allHeaders.(headerName) headerValue];
+ else
+ allHeaders.(headerName) = {headerValue};
+ end
+ else
+ done = true;
+ end
+end
+
+firstHeaders = struct;
+fn = fieldnames(allHeaders);
+for iHeader = 1:length(fn)
+ curField = fn{iHeader};
+ firstHeaders.(curField) = allHeaders.(curField){1};
+end
+
+status = struct(...
+ 'value', urlConnection.getResponseCode(),...
+ 'msg', char(urlConnection.getResponseMessage));
+
+%PROCESSING OF OUTPUT
+%----------------------------------------------------------
+byteArrayOutputStream = java.io.ByteArrayOutputStream;
+% This StreamCopier is unsupported and may change at any time. OH GREAT :/
+isc = InterruptibleStreamCopier.getInterruptibleStreamCopier;
+isc.copyStream(inputStream,byteArrayOutputStream);
+inputStream.close;
+byteArrayOutputStream.close;
+
+if in.CAST_OUTPUT
+ charset = '';
+
+ %Extraction of character set from Content-Type header if possible
+ if isfield(firstHeaders,'Content_Type')
+ text = firstHeaders.Content_Type;
+ %Always open to regexp improvements
+ charset = regexp(text,'(?<=charset=)[^\s]*','match','once');
+ end
+
+ if ~isempty(charset)
+ output = native2unicode(typecast(byteArrayOutputStream.toByteArray','uint8'),charset);
+ else
+ output = char(typecast(byteArrayOutputStream.toByteArray','uint8'));
+ end
+else
+ %uint8 is more useful for later charecter conversions
+ %uint8 or int8 is somewhat arbitary at this point
+ output = typecast(byteArrayOutputStream.toByteArray','uint8');
+end
+
+extras = struct;
+extras.allHeaders = allHeaders;
+extras.firstHeaders = firstHeaders;
+extras.status = status;
+%Gets eventual url even with redirection
+extras.url = char(urlConnection.getURL);
+extras.isGood = isGood;
+
+
+
+end
+
+function headerNameOut = fixHeaderCasing(headerName)
+%fixHeaderCasing Forces standard casing of headers
+%
+% headerNameOut = fixHeaderCasing(headerName)
+%
+% This is important for field access in a structure which
+% is case sensitive
+%
+% Not yet finished.
+% I've been adding to this function as problems come along
+
+ switch lower(headerName)
+ case 'location'
+ headerNameOut = 'Location';
+ case 'content_type'
+ headerNameOut = 'Content_Type';
+ otherwise
+ headerNameOut = headerName;
+ end
+end
+
+%==========================================================================
+%==========================================================================
+%==========================================================================
+
+function urlConnection = getURLConnection(urlChar)
+%getURLConnection
+%
+% urlConnection = getURLConnection(urlChar)
+
+% Determine the protocol (before the ":").
+protocol = urlChar(1:find(urlChar==':',1)-1);
+
+
+% Try to use the native handler, not the ice.* classes.
+try
+ switch protocol
+ case 'http'
+ %http://www.docjar.com/docs/api/sun/net/www/protocol/http/HttpURLConnection.html
+ handler = sun.net.www.protocol.http.Handler;
+ case 'https'
+ handler = sun.net.www.protocol.https.Handler;
+ end
+catch ME
+ handler = [];
+end
+
+% Create the URL object.
+try
+ if isempty(handler)
+ url = java.net.URL(urlChar);
+ else
+ url = java.net.URL([],urlChar,handler);
+ end
+catch ME
+ error('Failure to parse URL or protocol not supported for:\nURL: %s',urlChar);
+end
+
+% Get the proxy information using MathWorks facilities for unified proxy
+% preference settings.
+mwtcp = com.mathworks.net.transport.MWTransportClientPropertiesFactory.create();
+proxy = mwtcp.getProxy();
+
+% Open a connection to the URL.
+if isempty(proxy)
+ urlConnection = url.openConnection;
+else
+ urlConnection = url.openConnection(proxy);
+end
+
+
+end
diff --git a/plotly/plotly_aux/urlread2/urlread_notes.txt b/plotly/plotly_aux/urlread2/urlread_notes.txt
index 7a2ba14f..8257f092 100755
--- a/plotly/plotly_aux/urlread2/urlread_notes.txt
+++ b/plotly/plotly_aux/urlread2/urlread_notes.txt
@@ -1,86 +1,86 @@
-==========================================================================
- Unicode & Matlab
-==========================================================================
-native2unicode - works with uint8, fails with char
-
-Taking a unicode character and encoding as bytes:
-unicode2native(char(1002),'UTF-8')
-back to the character:
-native2unicode(uint8([207 170]),'UTF-8')
-this doesn't work:
-native2unicode(char([207 170]),'UTF-8')
-in documentation: If BYTES is a CHAR vector, it is returned unchanged.
-
-Java - only supports int8
-Matlab to Java -> uint8 or int8 to bytes
-Java to Matlab -> bytes to int8
-char - 16 bit
-
-Maintenance of underlying bytes:
-typecast(java.lang.String(uint8(250)).getBytes,'uint8') = 250
-see documentation: Handling Data Returned from a Java Method
-
-Command Window difficulty
---------------------------------------------------------------------
-The typical font in the Matlab command window will often fail to render
-unicode properly. I often can see unicode better in the variable editor
-although this may be fixed if you change your font preferences ...
-Copying unicode from the command window often results in the
-generations of the value 26 (aka substitute)
-
-More documentation on input/output to urlread2 to follow eventually ...
-
-small notes to self:
-for output
-native2unicode(uint8(output),encoding)
-
-==========================================================================
- HTTP Headers
-==========================================================================
-Handling of repeated http readers is a bit of a tricky situation. Most
-headers are not repeated although sometimes http clients will assume this
-for too many headers which can result in a problem if you want to see
-duplicated headers. I've passed the problem onto the user who can decide
-to handle it how they wish instead of providing the right solution, which
-after some brief searching, I am not sure exists.
-
-==========================================================================
- PROBLEMS
-==========================================================================
-1) Page requires following a redirect:
-%-------------------------------------------
-ref: http://www.mathworks.com/matlabcentral/newsreader/view_thread/302571
-fix: FOLLOW_REDIRECTS is enabled by default, you're fine.
-
-2) Basic authentication required:
-%------------------------------------------
-Create and pass in the following header:
-user = 'test';
-password = 'test';
-encoder = sun.misc.BASE64Encoder();
-str = java.lang.String([user ':' password]) %NOTE: format may be
-%different for your server
-header = http_createHeader('Authorization',char(encoder.encode(str.getBytes())))
-NOTE: Ideally you would make this a function
-
-3) The text returned doesn't make sense.
-%-----------------------------------------
-The text may not be encoded correctly. Requires native2unicode function.
-See Unicode & Matlab section above.
-
-4) I get a different result in my web browser than I do in Matlab
-%-----------------------------------------
-This is generally seen for two reasons.
-1 - The easiest and silly reason is user agent filtering.
-When you make a request you identify yourself
-as being a particular "broswer" or "user agent". Setting a header
-with the user agent of the browser may fix the problem.
-See: http://en.wikipedia.org/wiki/User_agent
-See: http://whatsmyuseragent.com
-value = ''
-header = http_createHeader('User-Agent',value);
-2 - You are not processing cookies and the server is not sending
-you information because you haven't sent it cookies (everyone likes em!)
-I've implemented cookie support but it requires some extra files that
-I need to clean up. Feel free to email me if you'd really like to have them.
-
+==========================================================================
+ Unicode & Matlab
+==========================================================================
+native2unicode - works with uint8, fails with char
+
+Taking a unicode character and encoding as bytes:
+unicode2native(char(1002),'UTF-8')
+back to the character:
+native2unicode(uint8([207 170]),'UTF-8')
+this doesn't work:
+native2unicode(char([207 170]),'UTF-8')
+in documentation: If BYTES is a CHAR vector, it is returned unchanged.
+
+Java - only supports int8
+Matlab to Java -> uint8 or int8 to bytes
+Java to Matlab -> bytes to int8
+char - 16 bit
+
+Maintenance of underlying bytes:
+typecast(java.lang.String(uint8(250)).getBytes,'uint8') = 250
+see documentation: Handling Data Returned from a Java Method
+
+Command Window difficulty
+--------------------------------------------------------------------
+The typical font in the Matlab command window will often fail to render
+unicode properly. I often can see unicode better in the variable editor
+although this may be fixed if you change your font preferences ...
+Copying unicode from the command window often results in the
+generations of the value 26 (aka substitute)
+
+More documentation on input/output to urlread2 to follow eventually ...
+
+small notes to self:
+for output
+native2unicode(uint8(output),encoding)
+
+==========================================================================
+ HTTP Headers
+==========================================================================
+Handling of repeated http readers is a bit of a tricky situation. Most
+headers are not repeated although sometimes http clients will assume this
+for too many headers which can result in a problem if you want to see
+duplicated headers. I've passed the problem onto the user who can decide
+to handle it how they wish instead of providing the right solution, which
+after some brief searching, I am not sure exists.
+
+==========================================================================
+ PROBLEMS
+==========================================================================
+1) Page requires following a redirect:
+%-------------------------------------------
+ref: http://www.mathworks.com/matlabcentral/newsreader/view_thread/302571
+fix: FOLLOW_REDIRECTS is enabled by default, you're fine.
+
+2) Basic authentication required:
+%------------------------------------------
+Create and pass in the following header:
+user = 'test';
+password = 'test';
+encoder = sun.misc.BASE64Encoder();
+str = java.lang.String([user ':' password]) %NOTE: format may be
+%different for your server
+header = http_createHeader('Authorization',char(encoder.encode(str.getBytes())))
+NOTE: Ideally you would make this a function
+
+3) The text returned doesn't make sense.
+%-----------------------------------------
+The text may not be encoded correctly. Requires native2unicode function.
+See Unicode & Matlab section above.
+
+4) I get a different result in my web browser than I do in Matlab
+%-----------------------------------------
+This is generally seen for two reasons.
+1 - The easiest and silly reason is user agent filtering.
+When you make a request you identify yourself
+as being a particular "broswer" or "user agent". Setting a header
+with the user agent of the browser may fix the problem.
+See: http://en.wikipedia.org/wiki/User_agent
+See: http://whatsmyuseragent.com
+value = ''
+header = http_createHeader('User-Agent',value);
+2 - You are not processing cookies and the server is not sending
+you information because you haven't sent it cookies (everyone likes em!)
+I've implemented cookie support but it requires some extra files that
+I need to clean up. Feel free to email me if you'd really like to have them.
+
diff --git a/plotly/plotly_aux/urlread2/urlread_todos.txt b/plotly/plotly_aux/urlread2/urlread_todos.txt
index 86dd62d0..0434bcea 100755
--- a/plotly/plotly_aux/urlread2/urlread_todos.txt
+++ b/plotly/plotly_aux/urlread2/urlread_todos.txt
@@ -1,13 +1,13 @@
-==========================================================================
- IMPROVEMENTS
-==========================================================================
-1) The function could be improved to support file streaming both in sending
-and in receiving (saving) to reduce memory usage but this is very low priority
-
-2) Implement better casing handling
-
-3) Choose a better function name than urlread2 -> sorry Chris :)
-
-4) Support multipart/form-data, this ideally would be handled by a helper function
-
+==========================================================================
+ IMPROVEMENTS
+==========================================================================
+1) The function could be improved to support file streaming both in sending
+and in receiving (saving) to reduce memory usage but this is very low priority
+
+2) Implement better casing handling
+
+3) Choose a better function name than urlread2 -> sorry Chris :)
+
+4) Support multipart/form-data, this ideally would be handled by a helper function
+
5) Allow for throwing an error if the HTTP status code is an error (400) and 500 as well?
\ No newline at end of file
diff --git a/plotly/plotly_aux/urlread2/urlread_versionInfo.txt b/plotly/plotly_aux/urlread2/urlread_versionInfo.txt
index 6feb2133..a8448f49 100755
--- a/plotly/plotly_aux/urlread2/urlread_versionInfo.txt
+++ b/plotly/plotly_aux/urlread2/urlread_versionInfo.txt
@@ -1,13 +1,13 @@
-=====================
-Version 1.1
-3/25/2012
-
-Summary: Bug fixes related to Matlab throwing errors when it shouldn't have been. Thanks to Shane Lin for pointing out the problems.
-
-Bug Fix: Modified code so that http status errors wouldn't throw errors in the code, but rather would be passed on to the user to process
-
-Bug Fix: Provided GET example code apparently doesn't work for all users, changed to a different example.
-
-=====================
-Version 1
+=====================
+Version 1.1
+3/25/2012
+
+Summary: Bug fixes related to Matlab throwing errors when it shouldn't have been. Thanks to Shane Lin for pointing out the problems.
+
+Bug Fix: Modified code so that http status errors wouldn't throw errors in the code, but rather would be passed on to the user to process
+
+Bug Fix: Provided GET example code apparently doesn't work for all users, changed to a different example.
+
+=====================
+Version 1
3/17/2012
\ No newline at end of file
diff --git a/plotly/plotly_aux/validatedir.m b/plotly/plotly_aux/validatedir.m
index bdc4fbb1..bcf2752a 100644
--- a/plotly/plotly_aux/validatedir.m
+++ b/plotly/plotly_aux/validatedir.m
@@ -1,7 +1,7 @@
function validatedir(status, mess, messid, filename)
% check success of directory creation
if (status == 0)
- if(~strcmp(messid, 'MATLAB:MKDIR:DirectoryExists'))
+ if (~strcmp(messid, 'MATLAB:MKDIR:DirectoryExists'))
error(['Error saving %s folder: ' mess ', ' messid ...
'. Please contact support@plot.ly for assistance.'], ...
filename);
diff --git a/plotly/plotly_help_aux/updateplotlyhelp.m b/plotly/plotly_help_aux/updateplotlyhelp.m
index ee20d7a0..c01e5cc6 100644
--- a/plotly/plotly_help_aux/updateplotlyhelp.m
+++ b/plotly/plotly_help_aux/updateplotlyhelp.m
@@ -1,39 +1,37 @@
-%----UPDATE THE PLOTLY HELP GRAPH REFERENCE----%
function updateplotlyhelp
+ %----UPDATE THE PLOTLY HELP GRAPH REFERENCE----%
+ % remote Plotly Graph Reference url
+ remote = ['https://raw.githubusercontent.com/plotly/',...
+ 'graph_reference/master/graph_objs/matlab/graph_objs_keymeta.json'];
-% remote Plotly Graph Reference url
-remote = ['https://raw.githubusercontent.com/plotly/',...
- 'graph_reference/master/graph_objs/matlab/graph_objs_keymeta.json'];
+ % download the remote content
+ try
+ prContent = urlread(remote);
+ catch
+ fprintf(['\nAn error occurred while trying to read the latest\n',...
+ 'Plotly MATLAB API graph reference from:\n',...
+ 'https://github.com/plotly/graph_reference.\n']);
+ return
+ end
-% download the remote content
-try
- prContent = urlread(remote);
-catch
- fprintf(['\nAn error occurred while trying to read the latest\n',...
- 'Plotly MATLAB API graph reference from:\n',...
- 'https://github.com/plotly/graph_reference.\n']);
- return
-end
+ % load the json into a struct
+ pr = jsondecode(prContent);
-% load the json into a struct
-pr = jsondecode(prContent);
+ %----------------------MATLAB SPECIFIC TWEAKS-------------------------%
-%------------------------MATLAB SPECIFIC TWEAKS---------------------------%
+ %-key_type changes-%
+ pr.annotation.xref.key_type = 'plot_info';
+ pr.annotation.yref.key_type = 'plot_info';
+ pr.line.shape.key_type = 'plot_info';
-%-key_type changes-%
-pr.annotation.xref.key_type = 'plot_info';
-pr.annotation.yref.key_type = 'plot_info';
-pr.line.shape.key_type = 'plot_info';
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ % save directory
+ helpdir = fullfile(fileparts(which('updateplotlyhelp')), 'plotly_reference');
-% save directory
-helpdir = fullfile(fileparts(which('updateplotlyhelp')),'plotly_reference');
-
-% pr filename
-prname = fullfile(helpdir);
-
-%----save----%
-save(prname,'pr');
+ % pr filename
+ prname = fullfile(helpdir);
+ %----save----%
+ save(prname, 'pr');
end
\ No newline at end of file
diff --git a/plotly/plotly_offline_aux/getplotlyoffline.m b/plotly/plotly_offline_aux/getplotlyoffline.m
index f3879a74..765d6a28 100644
--- a/plotly/plotly_offline_aux/getplotlyoffline.m
+++ b/plotly/plotly_offline_aux/getplotlyoffline.m
@@ -1,5 +1,4 @@
function getplotlyoffline(plotly_bundle_url)
-
% download bundle
[plotly_bundle, extras] = urlread2(plotly_bundle_url, 'get');
@@ -32,7 +31,8 @@ function getplotlyoffline(plotly_bundle_url)
% success!
fprintf(['\nSuccess! You can now generate offline ', ...
- 'graphs.\nTo generate online graphs, run plotlysetup_online(username, api_key) ', ...
+ 'graphs.\nTo generate online graphs, run ', ...
+ 'plotlysetup_online(username, api_key) ', ...
'\nand use the ''offline'' flag of fig2plotly as ', ...
'follows:\n\n>> plot(1:10); fig2plotly(gcf, ', ...
'''offline'', false);\n\n'])
diff --git a/plotly/plotly_offline_aux/plotlyoffline.m b/plotly/plotly_offline_aux/plotlyoffline.m
index 21444a10..bff1454e 100644
--- a/plotly/plotly_offline_aux/plotlyoffline.m
+++ b/plotly/plotly_offline_aux/plotlyoffline.m
@@ -16,8 +16,8 @@
try
bundle = fileread(bundleFile);
% template dependencies
- depScript = sprintf('\n', ...
- bundle);
+ depScript = sprintf(['\n'], bundle);
catch
error(['Error reading: %s.\nPlease download the required ', ...
'dependencies using: >>getplotlyoffline \n', ...
@@ -50,35 +50,37 @@
% template environment vars
plotlyDomain = plotlyfig.UserData.PlotlyDomain;
envScript = sprintf([''], plotlyDomain, linkText);
+ 'window.PLOTLYENV=window.PLOTLYENV || {};', ...
+ 'window.PLOTLYENV.BASE_URL="%s";Plotly.LINKTEXT="%s";', ...
+ ''], plotlyDomain, linkText);
% template Plotly.plot
- script = sprintf(['\n Plotly.plot("%s", {\n"data": %s,\n"layout": %s,\n"frames": %s\n}).then(function(){'...
- '\n $(".%s.loading").remove();' ...
- '\n $(".link--embedview").text("%s");'...
- '\n });'], id, clean_jData, clean_jLayout, clean_jFrames,...
- id, linkText);
+ script = sprintf(['\n Plotly.plot("%s", {\n"data": %s,' ...
+ '\n"layout": %s,\n"frames": %s\n}).then(function(){'...
+ '\n $(".%s.loading").remove();' ...
+ '\n $(".link--embedview").text("%s");'...
+ '\n });'], id, clean_jData, clean_jLayout, ...
+ clean_jFrames, id, linkText);
- plotlyScript = sprintf(['\n' ...
- '
\n'], id, height, width, ...
- script);
+ plotlyScript = sprintf(['\n \n', ...
+ ''], ...
+ id, height, width, script);
% template entire script
offlineScript = [depScript envScript plotlyScript];
filename = plotlyfig.PlotOptions.FileName;
- if iscellstr(filename), filename = sprintf('%s ', filename{:}); end
+ if iscellstr(filename)
+ filename = sprintf('%s ', filename{:});
+ end
% remove the whitespace from the filename
cleanFilename = filename(filename~=' ');
htmlFilename = [cleanFilename '.html'];
% save the html file in the working directory
- plotlyOfflineFile = fullfile(plotlyfig.PlotOptions.SaveFolder, htmlFilename);
+ plotlyOfflineFile = fullfile(plotlyfig.PlotOptions.SaveFolder, ...
+ htmlFilename);
fileID = fopen(plotlyOfflineFile, 'w');
fprintf(fileID, offlineScript);
fclose(fileID);
@@ -88,5 +90,4 @@
% return the local file url to be rendered in the browser
response = ['file:///' plotlyOfflineFile];
-
end
diff --git a/plotly/plotly_setup_aux/addplotlystartup.m b/plotly/plotly_setup_aux/addplotlystartup.m
index 7b908bb4..3f13ffbe 100644
--- a/plotly/plotly_setup_aux/addplotlystartup.m
+++ b/plotly/plotly_setup_aux/addplotlystartup.m
@@ -1,46 +1,59 @@
function [warnings] = addplotlystartup(startupPaths)
-%[1]looks at statup.m files specified by the entries of startupPaths
-%[2]appends the addplotly function to startup.m files (if not already present)
-%[3]checks for other plotly addpath calls within any startup.m and outputs warning
+ %[1]looks at statup.m files specified by the entries of startupPaths
+ %[2]appends the addplotly function to startup.m files (if not already
+ % present)
+ %[3]checks for other plotly addpath calls within any startup.m and
+ % outputs warning
-%output warnings
-warnings = cell(size(startupPaths));
+ %output warnings
+ warnings = cell(size(startupPaths));
-for locs = 1:size(startupPaths,1);
- %addpath string for Plotly API
- addString = 'addpath(genpath(fullfile(matlabroot,''toolbox'',''plotly'')),''-end'');';
- %open current startup.m to read
- currentStartupID = fopen(startupPaths{locs},'r');
- if currentStartupID == -1, error('plotly:startupRead',...
- ['\n\nShoot! It looks like something went wrong reading the file: ' ...
- '\n' startupPaths{locs} '\n' ...
- '\nPlease contact your system admin or post a topic on https://community.plotly.com/c/api/matlab/ for more \ninformation. In the ' ...
- 'mean time you can add the Plotly API \nto your search path manually whenever you need it! \n\n']);
- end
- %check for any instances of the addplotlyapi function
- startupScan = textscan(currentStartupID, '%s', 'delimiter', '\n', 'whitespace', '');
- startupLines = startupScan{1};
- Index = find(strcmp(startupLines,addString));
- otherPlotlyOccurrence = findstr(fileread(startupPaths{locs}),'plotly');
- %if addString is not in startup.m add it
- if(~any(Index));
- %reopen current startup.m with new permission
- currentStartupID = fopen(startupPaths{locs},'a+');
- if currentStartupID == -1, error('plotly:startupWrite',...
- ['\n\nShoot! It looks like something went wrong writing to the file: ' ...
- '\n\n' startupPaths{locs} '\n' ...
- '\nPlease contact your system admin or post a topic on https://community.plotly.com/c/api/matlab/ for more \ninformation. In the ' ...
- 'mean time you can add the Plotly API \nto your search path manually whenever you need it! \n']);
+ for locs = 1:size(startupPaths,1);
+ %addpath string for Plotly API
+ addString = ['addpath(genpath(fullfile(matlabroot,''toolbox'',' ...
+ '''plotly'')),''-end'');'];
+ %open current startup.m to read
+ currentStartupID = fopen(startupPaths{locs},'r');
+ if currentStartupID == -1, error('plotly:startupRead', ...
+ ['\n\nShoot! It looks like something went wrong ' ...
+ 'reading the file: \n' startupPaths{locs} '\n\n' ...
+ 'Please contact your system admin or post a topic on ' ...
+ 'https://community.plotly.com/c/api/matlab/ for more ' ...
+ '\ninformation. In the mean time you can add the ' ...
+ 'Plotly API \nto your search path manually whenever ' ...
+ 'you need it! \n\n']);
end
- fprintf(currentStartupID,['\n' addString]);
- end
- if(length(Index) ~= length(otherPlotlyOccurrence));
- warnings{locs} = ['\n[WARNING]: \n\nWe found an addpath specification for another version of Plotly at: ' ...
- '\n\n' startupPaths{locs} '\n\nyou may be forcing MATLAB to look for an older version of Plotly!\n\n'];
- else
- warnings{locs} = '';
+ %check for any instances of the addplotlyapi function
+ startupScan = textscan(currentStartupID, '%s', 'delimiter', ...
+ '\n', 'whitespace', '');
+ startupLines = startupScan{1};
+ Index = find(strcmp(startupLines,addString));
+ otherPlotlyOccurrence = findstr(fileread(startupPaths{locs}), ...
+ 'plotly');
+ %if addString is not in startup.m add it
+ if (~any(Index))
+ %reopen current startup.m with new permission
+ currentStartupID = fopen(startupPaths{locs},'a+');
+ if currentStartupID == -1
+ error('plotly:startupWrite', ['\n\nShoot! It looks ' ...
+ 'like something went wrong writing to the ' ...
+ 'file: \n\n' startupPaths{locs} '\n\nPlease ' ...
+ 'contact your system admin or post a topic on ' ...
+ 'https://community.plotly.com/c/api/matlab/ ' ...
+ 'for more \ninformation. In the mean time you ' ...
+ 'can add the Plotly API \nto your search path ' ...
+ 'manually whenever you need it! \n']);
+ end
+ fprintf(currentStartupID,['\n' addString]);
+ end
+ if (length(Index) ~= length(otherPlotlyOccurrence))
+ warnings{locs} = ['\n[WARNING]: \n\nWe found an addpath ' ...
+ 'specification for another version of Plotly at: ' ...
+ '\n\n' startupPaths{locs} '\n\nyou may be forcing ' ...
+ 'MATLAB to look for an older version of Plotly!\n\n'];
+ else
+ warnings{locs} = '';
+ end
+ fclose(currentStartupID);
end
- fclose(currentStartupID);
-end
end
-
diff --git a/plotly/plotly_setup_aux/plotlycleanup.m b/plotly/plotly_setup_aux/plotlycleanup.m
index d4dc52f6..35d0b47b 100644
--- a/plotly/plotly_setup_aux/plotlycleanup.m
+++ b/plotly/plotly_setup_aux/plotlycleanup.m
@@ -1,98 +1,97 @@
function removed = plotlycleanup
+ % cleans up any old Plotly API MATLAB library files and folders
-% cleans up any old Plotly API MATLAB library files and folders
+ % initialize output
+ removed = {};
-% initialize output
-removed = {};
+ %----REMOVE WRAPPER FILES----%
+ REMOVEFILES = {'plotly.m'};
-%----REMOVE WRAPPER FILES----%
-REMOVEFILES = {'plotly.m'};
+ %----REMOVE WRAPPER FOLDERS----%
+ REMOVEFOLDERS = {'fig2plotly_aux'};
-%----REMOVE WRAPPER FOLDERS----%
-REMOVEFOLDERS = {'fig2plotly_aux'};
-
-%----check for local Plotly instances----%
-try
- plotlyScriptDirs = which('plotly.m','-all');
-
- if isempty(plotlyScriptDirs);
- error('plotly:missingScript',...
- ['\n\nWe were unable to locate plotly.m. Please Add this\n',...
- 'script to your MATLAB search path and try again.\n\n']);
+ %----check for local Plotly instances----%
+ try
+ plotlyScriptDirs = which('plotly.m','-all');
+ if isempty(plotlyScriptDirs);
+ error('plotly:missingScript', ['\n\nWe were unable to ' ...
+ 'locate plotly.m. Please Add this\nscript to your ' ...
+ 'MATLAB search path and try again.\n\n']);
+ end
+ catch exception %locating plotly error catch...
+ fprintf(['\n\n' exception.identifier exception.message '\n\n']);
+ return
end
-
-catch exception %locating plotly error catch...
- fprintf(['\n\n' exception.identifier exception.message '\n\n']);
- return
-end
-% plotly toolbox directory
-plotlyToolboxDir = fullfile(matlabroot,'toolbox','plotly');
+ % plotly toolbox directory
+ plotlyToolboxDir = fullfile(matlabroot,'toolbox','plotly');
-% find the location of all plotly/ directories
-dircount = 1;
-for d = 1:length(plotlyScriptDirs)
- %parse filepath string at the Plotly directory
- plotlyLoc = strfind(fileparts(plotlyScriptDirs{d}),fullfile('MATLAB-api-master','plotly'));
- plotlyToolboxLoc = strfind(fileparts(plotlyScriptDirs{d}),plotlyToolboxDir);
- if ~isempty(plotlyLoc)
- plotlyDirs{dircount} = fullfile(plotlyScriptDirs{d}(1:plotlyLoc-1),'MATLAB-api-master','plotly');
- dircount = dircount + 1;
- elseif ~isempty(plotlyToolboxLoc)
- plotlyDirs{dircount} = plotlyToolboxDir;
- dircount = dircount + 1;
+ % find the location of all plotly/ directories
+ dircount = 1;
+ for d = 1:length(plotlyScriptDirs)
+ %parse filepath string at the Plotly directory
+ plotlyLoc = strfind(fileparts(plotlyScriptDirs{d}), ...
+ fullfile('MATLAB-api-master','plotly'));
+ plotlyToolboxLoc = strfind(fileparts(plotlyScriptDirs{d}), ...
+ plotlyToolboxDir);
+ if ~isempty(plotlyLoc)
+ plotlyDirs{dircount} = fullfile( ...
+ plotlyScriptDirs{d}(1:plotlyLoc-1), ...
+ 'MATLAB-api-master','plotly');
+ dircount = dircount + 1;
+ elseif ~isempty(plotlyToolboxLoc)
+ plotlyDirs{dircount} = plotlyToolboxDir;
+ dircount = dircount + 1;
+ end
end
-end
-for d = 1:length(plotlyDirs)
-
- % add plotlydirs to searchpath (will be removed in future once handled by plotlyupdate)
- addpath(genpath(plotlyDirs{d}));
-
- % delete files from plotly directory
- removefiles = fullfile(plotlyDirs{d}, REMOVEFILES);
-
- for f = 1:length(removefiles)
+ for d = 1:length(plotlyDirs)
+ % add plotlydirs to searchpath (will be removed in future once
+ % handled by plotlyupdate)
+ addpath(genpath(plotlyDirs{d}));
- % remove removefiles filepath from searchpath
- rmpath(fileparts(removefiles{f}));
+ % delete files from plotly directory
+ removefiles = fullfile(plotlyDirs{d}, REMOVEFILES);
- if exist(removefiles{f},'file')
- delete(removefiles{f});
- % update removed list
- removed = [removed removefiles{f}];
+ for f = 1:length(removefiles)
+ % remove removefiles filepath from searchpath
+ rmpath(fileparts(removefiles{f}));
+
+ if exist(removefiles{f},'file')
+ delete(removefiles{f});
+ % update removed list
+ removed = [removed removefiles{f}];
+ end
+
+ % add removefiles filepath back to searchpath
+ addpath(fileparts(removefiles{f}));
end
-
- % add removefiles filepath back to searchpath
- addpath(fileparts(removefiles{f}));
-
- end
- % remove folders from plotly directory
- removefolders = fullfile(plotlyDirs{d},REMOVEFOLDERS);
-
- for f = 1:length(removefolders)
- if exist(removefolders{f},'dir')
-
+ % remove folders from plotly directory
+ removefolders = fullfile(plotlyDirs{d},REMOVEFOLDERS);
+
+ for f = 1:length(removefolders)
+ if ~exist(removefolders{f}, 'dir')
+ continue
+ end
%remove folder from path
rmpath(genpath(removefolders{f}));
%delete folder/subfolders
try
status = rmdir(removefolders{f},'s');
-
if (status == 0)
- error('plotly:deletePlotlyAPI',...
- ['\n\nShoot! It looks like something went wrong removing the Plotly API ' ...
- 'from the MATLAB toolbox directory \n' ...
- 'Please contact your system admin or post a topic on https://community.plotly.com/c/api/matlab/ for more information. \n\n']);
+ error('plotly:deletePlotlyAPI', ['\n\nShoot! It ' ...
+ 'looks like something went wrong removing ' ...
+ 'the Plotly API from the MATLAB toolbox ' ...
+ 'directory \nPlease contact your system ' ...
+ 'admin or post a topic on ' ...
+ 'https://community.plotly.com/c/api/matlab/ ' ...
+ 'for more information. \n\n']);
end
-
% update removed list
removed = [removed removefolders{f}];
-
end
- end
- end
-end
+ end
+ end
end
diff --git a/plotly/plotly_user_aux/loadplotlyconfig.m b/plotly/plotly_user_aux/loadplotlyconfig.m
index 75bd975f..fa763d94 100644
--- a/plotly/plotly_user_aux/loadplotlyconfig.m
+++ b/plotly/plotly_user_aux/loadplotlyconfig.m
@@ -1,30 +1,28 @@
function config = loadplotlyconfig()
+ userhome = getuserdir();
-userhome = getuserdir();
+ plotly_config_file = fullfile(userhome,'.plotly','.config');
-plotly_config_file = fullfile(userhome,'.plotly','.config');
+ % check if config exist
+ if ~exist(plotly_config_file, 'file')
+ error('Plotly:ConfigNotFound', ['It looks like you haven''t ' ...
+ 'set up your plotly account configuration file yet.\n' ...
+ 'To get started, save your plotly/stream endpoint ' ...
+ 'domain by calling:\n>>> saveplotlyconfig(' ...
+ 'plotly_domain, plotly_streaming_domain)\n\nFor more ' ...
+ 'help, see https://plot.ly/MATLAB or contact ' ...
+ 'chris@plot.ly.']);
+ end
-% check if config exist
-if ~exist(plotly_config_file, 'file')
- error('Plotly:ConfigNotFound',...
- ['It looks like you haven''t set up your plotly '...
- 'account configuration file yet.\nTo get started, save your '...
- 'plotly/stream endpoint domain by calling:\n'...
- '>>> saveplotlyconfig(plotly_domain, plotly_streaming_domain)\n\n'...
- 'For more help, see https://plot.ly/MATLAB or contact '...
- 'chris@plot.ly.']);
-end
-
-fileIDConfig = fopen(plotly_config_file, 'r');
-
-if(fileIDConfig == -1)
- error('plotly:loadconfig', ...
- ['There was an error reading your configuration file at '...
- plotly_credentials_file '. Contact chris@plot.ly for support.']);
-end
+ fileIDConfig = fopen(plotly_config_file, 'r');
-config_string_array = fread(fileIDConfig, '*char');
-config_string = sprintf('%s',config_string_array);
-config = jsondecode(config_string);
+ if (fileIDConfig == -1)
+ error('plotly:loadconfig', ['There was an error reading your ' ...
+ 'configuration file at ' plotly_credentials_file ...
+ '. Contact chris@plot.ly for support.']);
+ end
+ config_string_array = fread(fileIDConfig, '*char');
+ config_string = sprintf('%s',config_string_array);
+ config = jsondecode(config_string);
end
diff --git a/plotly/plotly_user_aux/loadplotlycredentials.m b/plotly/plotly_user_aux/loadplotlycredentials.m
index ca2057b2..b87b33ae 100644
--- a/plotly/plotly_user_aux/loadplotlycredentials.m
+++ b/plotly/plotly_user_aux/loadplotlycredentials.m
@@ -1,30 +1,27 @@
function creds = loadplotlycredentials()
+ userhome = getuserdir();
-userhome = getuserdir();
+ plotly_credentials_file = fullfile(userhome, '.plotly', '.credentials');
-plotly_credentials_file = fullfile(userhome,'.plotly','.credentials');
+ % check if credentials exist
+ if ~exist(plotly_credentials_file, 'file')
+ error('Plotly:CredentialsNotFound', ['It looks like you ' ...
+ 'haven''t set up your plotly account credentials ' ...
+ 'yet.\nTo get started, save your plotly username and ' ...
+ 'API key by calling:\n>>> saveplotlycredentials(' ...
+ 'username, api_key)\n\nFor more help, see ' ...
+ 'https://plot.ly/MATLAB or contact chris@plot.ly.']);
+ end
-% check if credentials exist
-if ~exist(plotly_credentials_file, 'file')
- error('Plotly:CredentialsNotFound',...
- ['It looks like you haven''t set up your plotly '...
- 'account credentials yet.\nTo get started, save your '...
- 'plotly username and API key by calling:\n'...
- '>>> saveplotlycredentials(username, api_key)\n\n'...
- 'For more help, see https://plot.ly/MATLAB or contact '...
- 'chris@plot.ly.']);
-end
-
-fileIDCred = fopen(plotly_credentials_file, 'r');
-
-if(fileIDCred == -1)
- error('plotly:loadcredentials', ...
- ['There was an error reading your credentials file at '...
- plotly_credentials_file '. Contact chris@plot.ly for support.']);
-end
+ fileIDCred = fopen(plotly_credentials_file, 'r');
-creds_string_array = fread(fileIDCred, '*char');
-creds_string = sprintf('%s',creds_string_array);
-creds = jsondecode(creds_string);
+ if (fileIDCred == -1)
+ error('plotly:loadcredentials', ['There was an error reading ' ...
+ 'your credentials file at ' plotly_credentials_file ...
+ '. Contact chris@plot.ly for support.']);
+ end
+ creds_string_array = fread(fileIDCred, '*char');
+ creds_string = sprintf('%s',creds_string_array);
+ creds = jsondecode(creds_string);
end
diff --git a/plotly/plotly_user_aux/saveplotlyconfig.m b/plotly/plotly_user_aux/saveplotlyconfig.m
index dd1e1c0f..45f99715 100644
--- a/plotly/plotly_user_aux/saveplotlyconfig.m
+++ b/plotly/plotly_user_aux/saveplotlyconfig.m
@@ -1,68 +1,65 @@
function saveplotlyconfig(plotly_domain,plotly_streaming_domain)
-% Save plotly config info.
-% Plotly config info are saved as JSON strings
-% in ~/.plotly/.config
+ % Save plotly config info.
+ % Plotly config info are saved as JSON strings
+ % in ~/.plotly/.config
-% catch missing input arguments
-if nargin < 1
- error('plotly:saveconfig', ...
- ['Incorrect number of inputs. Please save your configuration ', ...
- 'as follows: >> saveplotlyconfig(plotly_domain,', ...
- '[optional]plotly_streaming_domain)']);
-end
+ % catch missing input arguments
+ if nargin < 1
+ error('plotly:saveconfig', ['Incorrect number of inputs. ' ...
+ 'Please save your configuration as follows: >> ' ...
+ 'saveplotlyconfig(plotly_domain,[optional]' ...
+ 'plotly_streaming_domain)']);
+ end
-% if the config file exists, then load it up
-try
- config = loadplotlyconfig();
-catch
- config = struct();
-end
+ % if the config file exists, then load it up
+ try
+ config = loadplotlyconfig();
+ catch
+ config = struct();
+ end
-% Create the .plotly folder
-userhome = getuserdir();
+ % Create the .plotly folder
+ userhome = getuserdir();
-plotly_config_folder = fullfile(userhome,'.plotly');
-plotly_config_file = fullfile(plotly_config_folder, '.config');
+ plotly_config_folder = fullfile(userhome, '.plotly');
+ plotly_config_file = fullfile(plotly_config_folder, '.config');
-[status, mess, messid] = mkdir(plotly_config_folder);
+ [status, mess, messid] = mkdir(plotly_config_folder);
-if (status == 0)
- if(~strcmp(messid, 'MATLAB:MKDIR:DirectoryExists'))
- error('plotly:saveconfig',...
- ['Error saving configuration folder at ' ...
- plotly_credentials_folder ': '...
- mess ', ' messid '. Get in touch at ' ...
- 'chris@plot.ly for support.']);
+ if (status == 0)
+ if (~strcmp(messid, 'MATLAB:MKDIR:DirectoryExists'))
+ error('plotly:saveconfig', ['Error saving configuration ' ...
+ 'folder at ' plotly_credentials_folder ': ' mess ...
+ ', ' messid '. Get in touch at chris@plot.ly for ' ...
+ 'support.']);
+ end
end
-end
-fileIDConfig = fopen(plotly_config_file, 'w');
+ fileIDConfig = fopen(plotly_config_file, 'w');
-if(fileIDConfig == -1)
- error('plotly:saveconfiguration',...
- ['Error opening configuration file at '...
- plotly_credentials_file '. Get in touch at '...
- 'chris@plot.ly for support.']);
-end
+ if (fileIDConfig == -1)
+ error('plotly:saveconfiguration', ['Error opening ' ...
+ 'configuration file at ' plotly_credentials_file '. ' ...
+ 'Get in touch at chris@plot.ly for support.']);
+ end
-% get user credenitals
-[username, api_key] = signin;
+ % get user credenitals
+ [username, api_key] = signin;
-switch nargin
- case 1
- config.plotly_domain = plotly_domain;
- signin(username, api_key, plotly_domain);
- case 2
- config.plotly_domain = plotly_domain;
- signin(username, api_key, plotly_domain);
- config.plotly_streaming_domain= plotly_streaming_domain;
- otherwise %if neither endpoints are specified, no worries!
-end
-
-config_string = m2json(config);
+ switch nargin
+ case 1
+ config.plotly_domain = plotly_domain;
+ signin(username, api_key, plotly_domain);
+ case 2
+ config.plotly_domain = plotly_domain;
+ signin(username, api_key, plotly_domain);
+ config.plotly_streaming_domain= plotly_streaming_domain;
+ otherwise %if neither endpoints are specified, no worries!
+ end
-%write the json strings to the cred file
-fprintf(fileIDConfig,'%s',config_string);
-fclose(fileIDConfig);
+ config_string = m2json(config);
+ %write the json strings to the cred file
+ fprintf(fileIDConfig,'%s',config_string);
+ fclose(fileIDConfig);
end
diff --git a/plotly/plotly_user_aux/saveplotlycredentials.m b/plotly/plotly_user_aux/saveplotlycredentials.m
index 2c968547..f35054ff 100644
--- a/plotly/plotly_user_aux/saveplotlycredentials.m
+++ b/plotly/plotly_user_aux/saveplotlycredentials.m
@@ -1,67 +1,64 @@
function saveplotlycredentials(username, api_key, stream_ids)
-% Save plotly authentication credentials.
-% Plotly credentials are saved as JSON strings
-% in ~/.plotly/.credentials
+ % Save plotly authentication credentials.
+ % Plotly credentials are saved as JSON strings
+ % in ~/.plotly/.credentials
-% catch missing input arguments
-if nargin < 2
- error('plotly:savecredentials', ...
- ['Incorrect number of inputs. Please save your credentials ', ...
- 'as follows: >> saveplotlycredentials(username, api_key,', ...
- '[optional]stream_ids)']);
-end
+ % catch missing input arguments
+ if nargin < 2
+ error('plotly:savecredentials', ['Incorrect number of inputs. ' ...
+ 'Please save your credentials as follows: >> ' ...
+ 'saveplotlycredentials(username, api_key,[optional]' ...
+ 'stream_ids)']);
+ end
-% if the credentials file exists, then load it up
-try
- creds = loadplotlycredentials();
-catch
- creds = struct();
-end
+ % if the credentials file exists, then load it up
+ try
+ creds = loadplotlycredentials();
+ catch
+ creds = struct();
+ end
-% Create the .plotly folder
-userhome = getuserdir();
+ % Create the .plotly folder
+ userhome = getuserdir();
-plotly_credentials_folder = fullfile(userhome,'.plotly');
-plotly_credentials_file = fullfile(plotly_credentials_folder, '.credentials');
+ plotly_credentials_folder = fullfile(userhome, '.plotly');
+ plotly_credentials_file = fullfile(plotly_credentials_folder, '.credentials');
-[status, mess, messid] = mkdir(plotly_credentials_folder);
+ [status, mess, messid] = mkdir(plotly_credentials_folder);
-if (status == 0)
- if(~strcmp(messid, 'MATLAB:MKDIR:DirectoryExists'))
- error('plotly:savecredentials',...
- ['Error saving credentials folder at ' ...
- plotly_credentials_folder ': '...
- mess ', ' messid '. Get in touch at ' ...
- 'chris@plot.ly for support.']);
+ if (status == 0)
+ if (~strcmp(messid, 'MATLAB:MKDIR:DirectoryExists'))
+ error('plotly:savecredentials', ['Error saving ' ...
+ 'credentials folder at ' plotly_credentials_folder ...
+ ': ' mess ', ' messid '. Get in touch at ' ...
+ 'chris@plot.ly for support.']);
+ end
end
-end
-fileIDCred = fopen(plotly_credentials_file, 'w');
+ fileIDCred = fopen(plotly_credentials_file, 'w');
-if(fileIDCred == -1)
- error('plotly:savecredentials',...
- ['Error opening credentials file at '...
- plotly_credentials_file '. Get in touch at '...
- 'chris@plot.ly for support.']);
-end
-
-switch nargin
- case 2
- creds.username = username;
- creds.api_key = api_key;
- case 3
- creds.username = username;
- creds.api_key = api_key;
- creds.stream_ids = stream_ids;
-end
+ if (fileIDCred == -1)
+ error('plotly:savecredentials', ['Error opening credentials ' ...
+ 'file at ' plotly_credentials_file '. Get in touch at ' ...
+ 'chris@plot.ly for support.']);
+ end
-creds_string = m2json(creds);
+ switch nargin
+ case 2
+ creds.username = username;
+ creds.api_key = api_key;
+ case 3
+ creds.username = username;
+ creds.api_key = api_key;
+ creds.stream_ids = stream_ids;
+ end
-%write the json strings to the cred file
-fprintf(fileIDCred,'%s',creds_string);
-fclose(fileIDCred);
+ creds_string = m2json(creds);
-%signin using newly saved credentials
-signin(username, api_key);
+ %write the json strings to the cred file
+ fprintf(fileIDCred, '%s', creds_string);
+ fclose(fileIDCred);
+ %signin using newly saved credentials
+ signin(username, api_key);
end
diff --git a/plotly/plotly_user_aux/signin.m b/plotly/plotly_user_aux/signin.m
index 18741db1..2a71ed82 100644
--- a/plotly/plotly_user_aux/signin.m
+++ b/plotly/plotly_user_aux/signin.m
@@ -1,38 +1,39 @@
function [un, key, domain] = signin(varargin)
-% SIGNIN(username, api_key, plotly_domain) Sign In to a plotly session
-%
-% See also plotly, signup
-%
-% For full documentation and examples, see https://plot.ly/matlab/getting-started/
+ % SIGNIN(username, api_key, plotly_domain) Sign In to a plotly session
+ %
+ % See also plotly, signup
+ %
+ % For full documentation and examples, see
+ % https://plot.ly/matlab/getting-started/
-persistent USERNAME KEY PLOTLY_DOMAIN
-if nargin > 1 && ischar(varargin{1}) && ischar(varargin{2})
- USERNAME = varargin{1};
- KEY = varargin{2};
- mlock;
-elseif isempty(USERNAME) || isempty(KEY)
- creds = loadplotlycredentials();
- USERNAME = creds.username;
- KEY = creds.api_key;
-end
+ persistent USERNAME KEY PLOTLY_DOMAIN
+ if nargin > 1 && ischar(varargin{1}) && ischar(varargin{2})
+ USERNAME = varargin{1};
+ KEY = varargin{2};
+ mlock;
+ elseif isempty(USERNAME) || isempty(KEY)
+ creds = loadplotlycredentials();
+ USERNAME = creds.username;
+ KEY = creds.api_key;
+ end
-un = USERNAME;
-key = KEY;
+ un = USERNAME;
+ key = KEY;
-if nargin > 2 && ischar(varargin{3})
- PLOTLY_DOMAIN = varargin{3};
-else
- if isempty(PLOTLY_DOMAIN)
- try
- config = loadplotlyconfig();
- PLOTLY_DOMAIN = config.plotly_domain;
- catch
- % fails cuz either creds haven't been written yet
- % or because plotly_domain wasn't a key in the
- % creds file.
- PLOTLY_DOMAIN = 'https://plot.ly';
+ if nargin > 2 && ischar(varargin{3})
+ PLOTLY_DOMAIN = varargin{3};
+ else
+ if isempty(PLOTLY_DOMAIN)
+ try
+ config = loadplotlyconfig();
+ PLOTLY_DOMAIN = config.plotly_domain;
+ catch
+ % fails cuz either creds haven't been written yet
+ % or because plotly_domain wasn't a key in the
+ % creds file.
+ PLOTLY_DOMAIN = 'https://plot.ly';
+ end
end
end
-end
-domain = PLOTLY_DOMAIN;
+ domain = PLOTLY_DOMAIN;
end
diff --git a/plotly/plotly_user_aux/signup.m b/plotly/plotly_user_aux/signup.m
index 68e703b1..73e6aeaf 100644
--- a/plotly/plotly_user_aux/signup.m
+++ b/plotly/plotly_user_aux/signup.m
@@ -1,27 +1,29 @@
function response = signup(username, email)
-% SIGNUP(username, email) Remote signup to plot.ly and plot.ly API
-% response = signup(username, email) makes an account on plotly and returns a temporary password and an api key
-%
-% See also plotly, plotlylayout, plotlystyle, signin
-%
-% For full documentation and examples, see https://plot.ly/api
+ % SIGNUP(username, email) Remote signup to plot.ly and plot.ly API
+ % response = signup(username, email) makes an account on plotly and
+ % returns a temporary password and an api key
+ %
+ % See also plotly, plotlylayout, plotlystyle, signin
+ %
+ % For full documentation and examples, see https://plot.ly/api
platform = 'MATLAB';
- payload = {'version', '0.2', 'un', username, 'email', email,'platform',platform};
+ payload = {'version', '0.2', 'un', username, 'email', email, ...
+ 'platform', platform};
url = 'https://plot.ly/apimkacct';
resp = urlread(url, 'Post', payload);
response = jsondecode(resp);
f = fieldnames(response);
- if any(strcmp(f,'error'))
+ if any(strcmp(f, 'error'))
error(response.error)
end
- if any(strcmp(f,'warning'))
+ if any(strcmp(f, 'warning'))
fprintf(response.warning)
end
- if any(strcmp(f,'message'))
+ if any(strcmp(f, 'message'))
fprintf(response.message)
end
- if any(strcmp(f,'filename'))
+ if any(strcmp(f, 'filename'))
plotlysession(response.filename)
end
-
+end
diff --git a/plotly/plotlyfig.m b/plotly/plotlyfig.m
index 39334953..f0a7353c 100644
--- a/plotly/plotlyfig.m
+++ b/plotly/plotlyfig.m
@@ -178,95 +178,95 @@
% parse property/values
for a = parseinit:2:length(varargin)
- if(strcmpi(varargin{a},'filename'))
+ if (strcmpi(varargin{a},'filename'))
obj.PlotOptions.FileName = varargin{a+1};
% overwrite if filename provided
obj.PlotOptions.FileOpt = 'overwrite';
end
- if(strcmpi(varargin{a},'savefolder'))
+ if (strcmpi(varargin{a},'savefolder'))
obj.PlotOptions.SaveFolder = varargin{a+1};
end
- if(strcmpi(varargin{a},'fileopt'))
+ if (strcmpi(varargin{a},'fileopt'))
obj.PlotOptions.FileOpt = varargin{a+1};
end
- if(strcmpi(varargin{a},'world_readable'))
+ if (strcmpi(varargin{a},'world_readable'))
obj.PlotOptions.WorldReadable = varargin{a+1};
end
- if(strcmpi(varargin{a},'link'))
+ if (strcmpi(varargin{a},'link'))
obj.PlotOptions.ShowURL = varargin{a+1};
end
- if(strcmpi(varargin{a},'open'))
+ if (strcmpi(varargin{a},'open'))
obj.PlotOptions.OpenURL = varargin{a+1};
end
- if(strcmpi(varargin{a},'strip'))
+ if (strcmpi(varargin{a},'strip'))
obj.PlotOptions.Strip = varargin{a+1};
end
- if(strcmpi(varargin{a},'writeFile'))
+ if (strcmpi(varargin{a},'writeFile'))
obj.PlotOptions.WriteFile = varargin{a+1};
end
- if(strcmpi(varargin{a},'visible'))
+ if (strcmpi(varargin{a},'visible'))
obj.PlotOptions.Visible = varargin{a+1};
end
- if(strcmpi(varargin{a},'offline'))
+ if (strcmpi(varargin{a},'offline'))
obj.PlotOptions.Offline = varargin{a+1};
end
- if(strcmpi(varargin{a},'showlink'))
+ if (strcmpi(varargin{a},'showlink'))
obj.PlotOptions.ShowLinkText = varargin{a+1};
end
- if(strcmpi(varargin{a},'linktext'))
+ if (strcmpi(varargin{a},'linktext'))
obj.PlotOptions.LinkText = varargin{a+1};
end
- if(strcmpi(varargin{a},'include_plotlyjs'))
+ if (strcmpi(varargin{a},'include_plotlyjs'))
obj.PlotOptions.IncludePlotlyjs = varargin{a+1};
end
- if(strcmpi(varargin{a},'layout'))
+ if (strcmpi(varargin{a},'layout'))
obj.layout= varargin{a+1};
end
- if(strcmpi(varargin{a},'data'))
+ if (strcmpi(varargin{a},'data'))
obj.data = varargin{a+1};
end
- if(strcmpi(varargin{a},'StripMargins'))
+ if (strcmpi(varargin{a},'StripMargins'))
obj.PlotOptions.StripMargins = varargin{a+1};
end
- if(strcmpi(varargin{a},'TriangulatePatch'))
+ if (strcmpi(varargin{a},'TriangulatePatch'))
obj.PlotOptions.TriangulatePatch = varargin{a+1};
end
- if(strcmpi(varargin{a},'TreatAs'))
+ if (strcmpi(varargin{a},'TreatAs'))
if ~iscell(varargin{a+1})
obj.PlotOptions.TreatAs = {varargin{a+1}};
else
obj.PlotOptions.TreatAs = varargin{a+1};
end
end
- if(strcmpi(varargin{a},'AxisEqual'))
+ if (strcmpi(varargin{a},'AxisEqual'))
obj.PlotOptions.AxisEqual = varargin{a+1};
end
- if(strcmpi(varargin{a},'AspectRatio'))
+ if (strcmpi(varargin{a},'AspectRatio'))
obj.PlotOptions.AspectRatio = varargin{a+1};
end
- if(strcmpi(varargin{a},'CameraEye'))
+ if (strcmpi(varargin{a},'CameraEye'))
obj.PlotOptions.CameraEye = varargin{a+1};
end
- if(strcmpi(varargin{a},'Quality'))
+ if (strcmpi(varargin{a},'Quality'))
obj.PlotOptions.Quality = varargin{a+1};
end
- if(strcmpi(varargin{a},'Zmin'))
+ if (strcmpi(varargin{a},'Zmin'))
obj.PlotOptions.Zmin = varargin{a+1};
end
- if(strcmpi(varargin{a},'FrameDuration'))
+ if (strcmpi(varargin{a},'FrameDuration'))
if varargin{a+1} > 0
obj.PlotOptions.FrameDuration = varargin{a+1};
end
end
- if(strcmpi(varargin{a},'FrameTransitionDuration'))
+ if (strcmpi(varargin{a},'FrameTransitionDuration'))
if varargin{a+1} >= 0
obj.PlotOptions.FrameTransitionDuration = varargin{a+1};
end
end
- if(strcmpi(varargin{a},'geoRenderType'))
+ if (strcmpi(varargin{a},'geoRenderType'))
obj.PlotOptions.geoRenderType = varargin{a+1};
end
- if(strcmpi(varargin{a},'DomainFactor'))
+ if (strcmpi(varargin{a},'DomainFactor'))
len = length(varargin{a+1});
obj.PlotOptions.DomainFactor(1:len) = varargin{a+1};
end
diff --git a/plotly/plotlyfig_aux/core/updateAnnotation.m b/plotly/plotlyfig_aux/core/updateAnnotation.m
index 09dc79d5..adca9e59 100644
--- a/plotly/plotlyfig_aux/core/updateAnnotation.m
+++ b/plotly/plotlyfig_aux/core/updateAnnotation.m
@@ -222,7 +222,4 @@
%-REVERT UNITS-%
obj.State.Text(anIndex).Handle.Units = textunits;
obj.State.Text(anIndex).Handle.FontUnits = fontunits;
-
- %---------------------------------------------------------------------%
-
end
diff --git a/plotly/plotlyfig_aux/core/updateAxis.m b/plotly/plotlyfig_aux/core/updateAxis.m
index 9424df08..34bcf337 100644
--- a/plotly/plotlyfig_aux/core/updateAxis.m
+++ b/plotly/plotlyfig_aux/core/updateAxis.m
@@ -1,206 +1,209 @@
-%----UPDATE AXIS DATA/LAYOUT----%
-
-function obj = updateAxis(obj,axIndex)
-
-% title: ...[DONE]
-% titlefont:...[DONE]
-% range:...[DONE]
-% domain:...[DONE]
-% type:...[DONE]
-% rangemode:...[NOT SUPPORTED IN MATLAB]
-% autorange:...[DONE]
-% showgrid:...[DONE]
-% zeroline:...[DONE]
-% showline:...[DONE
-% autotick:...[DONE]
-% nticks:...[DONE]
-% ticks:...[DONE]
-% showticklabels:...[DONE]
-% tick0:...[DONE]
-% dtick:...[DONE]
-% ticklen:...[DONE]
-% tickwidth:...[DONE]
-% tickcolor:...[DONE]
-% tickangle:...[NOT SUPPORTED IN MATLAB]
-% tickfont:...[DONE]
-% tickfont.family...[DONE]
-% tickfont.size...[DONE]
-% tickfont.color...[DONE]
-% tickfont.outlinecolor...[NOT SUPPORTED IN MATLAB]
-% exponentformat:...[DONE]
-% showexponent:...[NOT SUPPORTED IN MATLAB]
-% mirror:...[DONE]
-% gridcolor:...[DONE]
-% gridwidth:...[DONE]
-% zerolinecolor:...[NOT SUPPORTED IN MATLAB]
-% zerolinewidth:...[NOT SUPPORTED IN MATLAB]
-% linecolor:...[DONE]
-% linewidth:...[DONE]
-% anchor:...[DONE]
-% overlaying:...[DONE]
-% side:...[DONE]
-% position:...[NOT SUPPORTED IN MATLAB]
-
-%-STANDARDIZE UNITS-%
-axisUnits = obj.State.Axis(axIndex).Handle.Units;
-set(obj.State.Axis(axIndex).Handle,'Units','normalized')
-
-try
- fontUnits = obj.State.Axis(axIndex).Handle.FontUnits;
- set(obj.State.Axis(axIndex).Handle,'FontUnits','points')
-catch
- % TODO
-end
-
-%-AXIS DATA STRUCTURE-%
-axisData = obj.State.Axis(axIndex).Handle;
-
-%-------------------------------------------------------------------------%
-
-%-check if headmap axis-%
-isHeatmapAxis = axisData.Type == "heatmap";
-obj.PlotOptions.is_headmap_axis = isHeatmapAxis;
-
-%-------------------------------------------------------------------------%
-
-%-check if geo-axis-%
-isGeoaxis = isfield(axisData, 'Type') && strcmpi(axisData.Type, 'geoaxes');
-obj.PlotlyDefaults.isGeoaxis = isGeoaxis;
-
-%-------------------------------------------------------------------------%
-
-%-xaxis-%
-if isHeatmapAxis
- xaxis = extractHeatmapAxisData(obj,axisData, 'X');
- xExponentFormat = 0;
-else
- [xaxis, xExponentFormat] = extractAxisData(obj,axisData, 'X');
-end
-
-%-------------------------------------------------------------------------%
-
-%-yaxis-%
-if isHeatmapAxis
- yaxis = extractHeatmapAxisData(obj,axisData, 'Y');
- yExponentFormat = 0;
-else
- [yaxis, yExponentFormat] = extractAxisData(obj,axisData, 'Y');
-end
-
-%-------------------------------------------------------------------------%
-
-%-get position data-%
-axisPos = axisData.Position .* obj.PlotOptions.DomainFactor;
-if obj.PlotOptions.AxisEqual, axisPos(3:4) = min(axisPos(3:4)); end
-
-%-------------------------------------------------------------------------%
-
-%-xaxis domain-%
-xaxis.domain = min([axisPos(1) sum(axisPos([1,3]))], 1);
-scene.domain.x = xaxis.domain;
-
-%-------------------------------------------------------------------------%
-
-%-yaxis domain-%
-yaxis.domain = min([axisPos(2) sum(axisPos([2,4]))], 1);
-scene.domain.y = yaxis.domain;
-
-%-------------------------------------------------------------------------%
-
-%-get source axis-%
-[xsource, ysource, xoverlay, yoverlay] = findSourceAxis(obj,axIndex);
-
-%-------------------------------------------------------------------------%
-
-%-set exponent format-%
-anIndex = obj.State.Figure.NumTexts;
-
-if yExponentFormat ~= 0
- anIndex = anIndex + 1;
- exponentText = sprintf('x10^%d', yExponentFormat);
-
- obj.layout.annotations{anIndex}.text = exponentText;
- obj.layout.annotations{anIndex}.xref = ['x' num2str(xsource)];
- obj.layout.annotations{anIndex}.yref = ['y' num2str(ysource)];
- obj.layout.annotations{anIndex}.xanchor = 'left';
- obj.layout.annotations{anIndex}.yanchor = 'bottom';
- obj.layout.annotations{anIndex}.font.size = yaxis.tickfont.size;
- obj.layout.annotations{anIndex}.font.color = yaxis.tickfont.color;
- obj.layout.annotations{anIndex}.font.family = yaxis.tickfont.family;
- obj.layout.annotations{anIndex}.showarrow = false;
-
- if isfield(xaxis, 'range') && isfield(yaxis, 'range')
- obj.layout.annotations{anIndex}.x = min(xaxis.range);
- obj.layout.annotations{anIndex}.y = max(yaxis.range);
- end
-end
-
-if xExponentFormat ~= 0
- anIndex = anIndex + 1;
- exponentText = sprintf('x10^%d', xExponentFormat);
-
- obj.layout.annotations{anIndex}.text = exponentText;
- obj.layout.annotations{anIndex}.xref = ['x' num2str(xsource)];
- obj.layout.annotations{anIndex}.yref = ['y' num2str(ysource)];
- obj.layout.annotations{anIndex}.xanchor = 'left';
- obj.layout.annotations{anIndex}.yanchor = 'bottom';
- obj.layout.annotations{anIndex}.font.size = xaxis.tickfont.size;
- obj.layout.annotations{anIndex}.font.color = xaxis.tickfont.color;
- obj.layout.annotations{anIndex}.font.family = xaxis.tickfont.family;
- obj.layout.annotations{anIndex}.showarrow = false;
-
- if isfield(xaxis, 'range') && isfield(yaxis, 'range')
- obj.layout.annotations{anIndex}.x = max(xaxis.range);
- obj.layout.annotations{anIndex}.y = min(yaxis.range);
- end
-end
-
-%-------------------------------------------------------------------------%
-
-%-xaxis anchor-%
-xaxis.anchor = ['y' num2str(ysource)];
-
-%-------------------------------------------------------------------------%
-
-%-yaxis anchor-%
-yaxis.anchor = ['x' num2str(xsource)];
-
-%-------------------------------------------------------------------------%
-
-%-xaxis overlaying-%
-if xoverlay
- xaxis.overlaying = ['x' num2str(xoverlay)];
-end
-
-%-------------------------------------------------------------------------%
-
-%-yaxis overlaying-%
-if yoverlay
- yaxis.overlaying = ['y' num2str(yoverlay)];
-end
-
-%-------------------------------------------------------------------------%
-
-% update the layout field (do not overwrite source)
-if xsource == axIndex
- obj.layout = setfield(obj.layout,['xaxis' num2str(xsource)],xaxis);
- obj.layout = setfield(obj.layout,['scene' num2str(xsource)],scene);
-end
-
-%-------------------------------------------------------------------------%
-
-% update the layout field (do not overwrite source)
-if ysource == axIndex
- obj.layout = setfield(obj.layout,['yaxis' num2str(ysource)],yaxis);
-end
-
-%-------------------------------------------------------------------------%
-
-%-REVERT UNITS-%
-set(obj.State.Axis(axIndex).Handle,'Units',axisUnits);
-
-try
- set(obj.State.Axis(axIndex).Handle,'FontUnits',fontUnits);
-catch
- % TODO
-end
+function obj = updateAxis(obj,axIndex)
+ %----UPDATE AXIS DATA/LAYOUT----%
+
+ % title: ...[DONE]
+ % titlefont:...[DONE]
+ % range:...[DONE]
+ % domain:...[DONE]
+ % type:...[DONE]
+ % rangemode:...[NOT SUPPORTED IN MATLAB]
+ % autorange:...[DONE]
+ % showgrid:...[DONE]
+ % zeroline:...[DONE]
+ % showline:...[DONE
+ % autotick:...[DONE]
+ % nticks:...[DONE]
+ % ticks:...[DONE]
+ % showticklabels:...[DONE]
+ % tick0:...[DONE]
+ % dtick:...[DONE]
+ % ticklen:...[DONE]
+ % tickwidth:...[DONE]
+ % tickcolor:...[DONE]
+ % tickangle:...[NOT SUPPORTED IN MATLAB]
+ % tickfont:...[DONE]
+ % tickfont.family...[DONE]
+ % tickfont.size...[DONE]
+ % tickfont.color...[DONE]
+ % tickfont.outlinecolor...[NOT SUPPORTED IN MATLAB]
+ % exponentformat:...[DONE]
+ % showexponent:...[NOT SUPPORTED IN MATLAB]
+ % mirror:...[DONE]
+ % gridcolor:...[DONE]
+ % gridwidth:...[DONE]
+ % zerolinecolor:...[NOT SUPPORTED IN MATLAB]
+ % zerolinewidth:...[NOT SUPPORTED IN MATLAB]
+ % linecolor:...[DONE]
+ % linewidth:...[DONE]
+ % anchor:...[DONE]
+ % overlaying:...[DONE]
+ % side:...[DONE]
+ % position:...[NOT SUPPORTED IN MATLAB]
+
+ %-STANDARDIZE UNITS-%
+ axisUnits = obj.State.Axis(axIndex).Handle.Units;
+ set(obj.State.Axis(axIndex).Handle,'Units','normalized')
+
+ try
+ fontUnits = obj.State.Axis(axIndex).Handle.FontUnits;
+ set(obj.State.Axis(axIndex).Handle,'FontUnits','points')
+ catch
+ % TODO
+ end
+
+ %-AXIS DATA STRUCTURE-%
+ axisData = obj.State.Axis(axIndex).Handle;
+
+ %---------------------------------------------------------------------%
+
+ %-check if headmap axis-%
+ isHeatmapAxis = axisData.Type == "heatmap";
+ obj.PlotOptions.is_headmap_axis = isHeatmapAxis;
+
+ %---------------------------------------------------------------------%
+
+ %-check if geo-axis-%
+ isGeoaxis = isfield(axisData, 'Type') ...
+ && strcmpi(axisData.Type, 'geoaxes');
+ obj.PlotlyDefaults.isGeoaxis = isGeoaxis;
+
+ %---------------------------------------------------------------------%
+
+ %-xaxis-%
+ if isHeatmapAxis
+ xaxis = extractHeatmapAxisData(obj,axisData, 'X');
+ xExponentFormat = 0;
+ else
+ [xaxis, xExponentFormat] = extractAxisData(obj,axisData, 'X');
+ end
+
+ %---------------------------------------------------------------------%
+
+ %-yaxis-%
+ if isHeatmapAxis
+ yaxis = extractHeatmapAxisData(obj,axisData, 'Y');
+ yExponentFormat = 0;
+ else
+ [yaxis, yExponentFormat] = extractAxisData(obj,axisData, 'Y');
+ end
+
+ %---------------------------------------------------------------------%
+
+ %-get position data-%
+ axisPos = axisData.Position .* obj.PlotOptions.DomainFactor;
+ if obj.PlotOptions.AxisEqual
+ axisPos(3:4) = min(axisPos(3:4));
+ end
+
+ %---------------------------------------------------------------------%
+
+ %-xaxis domain-%
+ xaxis.domain = min([axisPos(1) sum(axisPos([1,3]))], 1);
+ scene.domain.x = xaxis.domain;
+
+ %---------------------------------------------------------------------%
+
+ %-yaxis domain-%
+ yaxis.domain = min([axisPos(2) sum(axisPos([2,4]))], 1);
+ scene.domain.y = yaxis.domain;
+
+ %---------------------------------------------------------------------%
+
+ %-get source axis-%
+ [xsource, ysource, xoverlay, yoverlay] = findSourceAxis(obj,axIndex);
+
+ %---------------------------------------------------------------------%
+
+ %-set exponent format-%
+ anIndex = obj.State.Figure.NumTexts;
+
+ if yExponentFormat ~= 0
+ anIndex = anIndex + 1;
+ exponentText = sprintf('x10^%d', yExponentFormat);
+
+ obj.layout.annotations{anIndex}.text = exponentText;
+ obj.layout.annotations{anIndex}.xref = ['x' num2str(xsource)];
+ obj.layout.annotations{anIndex}.yref = ['y' num2str(ysource)];
+ obj.layout.annotations{anIndex}.xanchor = 'left';
+ obj.layout.annotations{anIndex}.yanchor = 'bottom';
+ obj.layout.annotations{anIndex}.font.size = yaxis.tickfont.size;
+ obj.layout.annotations{anIndex}.font.color = yaxis.tickfont.color;
+ obj.layout.annotations{anIndex}.font.family = yaxis.tickfont.family;
+ obj.layout.annotations{anIndex}.showarrow = false;
+
+ if isfield(xaxis, 'range') && isfield(yaxis, 'range')
+ obj.layout.annotations{anIndex}.x = min(xaxis.range);
+ obj.layout.annotations{anIndex}.y = max(yaxis.range);
+ end
+ end
+
+ if xExponentFormat ~= 0
+ anIndex = anIndex + 1;
+ exponentText = sprintf('x10^%d', xExponentFormat);
+
+ obj.layout.annotations{anIndex}.text = exponentText;
+ obj.layout.annotations{anIndex}.xref = ['x' num2str(xsource)];
+ obj.layout.annotations{anIndex}.yref = ['y' num2str(ysource)];
+ obj.layout.annotations{anIndex}.xanchor = 'left';
+ obj.layout.annotations{anIndex}.yanchor = 'bottom';
+ obj.layout.annotations{anIndex}.font.size = xaxis.tickfont.size;
+ obj.layout.annotations{anIndex}.font.color = xaxis.tickfont.color;
+ obj.layout.annotations{anIndex}.font.family = xaxis.tickfont.family;
+ obj.layout.annotations{anIndex}.showarrow = false;
+
+ if isfield(xaxis, 'range') && isfield(yaxis, 'range')
+ obj.layout.annotations{anIndex}.x = max(xaxis.range);
+ obj.layout.annotations{anIndex}.y = min(yaxis.range);
+ end
+ end
+
+ %---------------------------------------------------------------------%
+
+ %-xaxis anchor-%
+ xaxis.anchor = ['y' num2str(ysource)];
+
+ %---------------------------------------------------------------------%
+
+ %-yaxis anchor-%
+ yaxis.anchor = ['x' num2str(xsource)];
+
+ %---------------------------------------------------------------------%
+
+ %-xaxis overlaying-%
+ if xoverlay
+ xaxis.overlaying = ['x' num2str(xoverlay)];
+ end
+
+ %---------------------------------------------------------------------%
+
+ %-yaxis overlaying-%
+ if yoverlay
+ yaxis.overlaying = ['y' num2str(yoverlay)];
+ end
+
+ %---------------------------------------------------------------------%
+
+ % update the layout field (do not overwrite source)
+ if xsource == axIndex
+ obj.layout = setfield(obj.layout,['xaxis' num2str(xsource)],xaxis);
+ obj.layout = setfield(obj.layout,['scene' num2str(xsource)],scene);
+ end
+
+ %---------------------------------------------------------------------%
+
+ % update the layout field (do not overwrite source)
+ if ysource == axIndex
+ obj.layout = setfield(obj.layout,['yaxis' num2str(ysource)],yaxis);
+ end
+
+ %---------------------------------------------------------------------%
+
+ %-REVERT UNITS-%
+ set(obj.State.Axis(axIndex).Handle,'Units',axisUnits);
+
+ try
+ set(obj.State.Axis(axIndex).Handle,'FontUnits',fontUnits);
+ catch
+ % TODO
+ end
+end
diff --git a/plotly/plotlyfig_aux/core/updateAxisMultipleYAxes.m b/plotly/plotlyfig_aux/core/updateAxisMultipleYAxes.m
index f57e470b..4cb30451 100644
--- a/plotly/plotlyfig_aux/core/updateAxisMultipleYAxes.m
+++ b/plotly/plotlyfig_aux/core/updateAxisMultipleYAxes.m
@@ -1,6 +1,5 @@
-%----UPDATE AXIS DATA/LAYOUT----%
-
function obj = updateAxisMultipleYAxes(obj,axIndex,yaxIndex)
+ %----UPDATE AXIS DATA/LAYOUT----%
%-STANDARDIZE UNITS-%
axisUnits = obj.State.Axis(axIndex).Handle.Units;
@@ -16,17 +15,17 @@
%-AXIS DATA STRUCTURE-%
axisData = obj.State.Axis(axIndex).Handle;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-xaxis-%
xaxis = extractAxisData(obj,axisData, 'X');
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-yaxis-%
[yaxis, yAxisLim] = extractAxisDataMultipleYAxes(obj, axisData, yaxIndex);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-getting and setting postion data-%
@@ -41,59 +40,59 @@
h = wh;
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-xaxis domain-%
xaxis.domain = min([xo xo + w],1);
scene.domain.x = min([xo xo + w],1);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-yaxis domain-%
yaxis.domain = min([yo yo + h],1);
scene.domain.y = min([yo yo + h],1);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
[xsource, ysource, xoverlay, yoverlay] = findSourceAxis(obj, axIndex, yaxIndex);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-xaxis anchor-%
xaxis.anchor = ['y' num2str(ysource)];
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-yaxis anchor-%
yaxis.anchor = ['x' num2str(xsource)];
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-xaxis overlaying-%
if xoverlay
xaxis.overlaying = ['x' num2str(xoverlay)];
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-yaxis overlaying-%
if yoverlay
yaxis.overlaying = ['y' num2str(yoverlay)];
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
% update the layout field (do not overwrite source)
if xsource == axIndex
obj.layout = setfield(obj.layout,['xaxis' num2str(xsource)],xaxis);
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
% update the layout field (do not overwrite source)
obj.layout = setfield(obj.layout,['yaxis' num2str(ysource)],yaxis);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-REVERT UNITS-%
set(obj.State.Axis(axIndex).Handle,'Units',axisUnits);
@@ -104,7 +103,7 @@
% TODO
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-do y-axes visibles-%
obj.PlotOptions.nPlots = obj.PlotOptions.nPlots + 1;
@@ -114,5 +113,5 @@
obj.data{plotIndex}.xaxis = ['x' num2str(xsource)];
obj.data{plotIndex}.yaxis = ['y' num2str(ysource)];
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
end
diff --git a/plotly/plotlyfig_aux/core/updateColorbar.m b/plotly/plotlyfig_aux/core/updateColorbar.m
index 517a96d1..17d33669 100644
--- a/plotly/plotlyfig_aux/core/updateColorbar.m
+++ b/plotly/plotlyfig_aux/core/updateColorbar.m
@@ -1,5 +1,4 @@
function obj = updateColorbar(obj,colorbarIndex)
-
% title: ...[DONE]
% titleside: ...[DONE]
% titlefont: ...[DONE]
@@ -44,9 +43,9 @@
%-STANDARDIZE UNITS-%
colorbarUnits = colorbarData.Units;
- set(obj.State.Colorbar(colorbarIndex).Handle,'Units','normalized');
+ set(obj.State.Colorbar(colorbarIndex).Handle, 'Units', 'normalized');
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-variable initialization-%
if isHG2
@@ -60,12 +59,14 @@
end
outlineColor = sprintf('rgb(%f,%f,%f)', outlineColor);
- lineWidth = colorbarData.LineWidth*obj.PlotlyDefaults.AxisLineIncreaseFactor;
- tickLength = min(obj.PlotlyDefaults.MaxTickLength,...
- max(colorbarData.TickLength(1)*colorbarData.Position(3)*obj.layout.width,...
- colorbarData.TickLength(1)*colorbarData.Position(4)*obj.layout.height));
+ lineWidth = colorbarData.LineWidth ...
+ * obj.PlotlyDefaults.AxisLineIncreaseFactor;
+ tickLength = min(obj.PlotlyDefaults.MaxTickLength, ...
+ max(colorbarData.TickLength(1) * colorbarData.Position(3) ...
+ * obj.layout.width, colorbarData.TickLength(1) ...
+ * colorbarData.Position(4) * obj.layout.height));
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-colorbar placement-%
colorbar.x = colorbarData.Position(1);
@@ -84,7 +85,7 @@
colorbar.thicknessmode = 'fraction';
colorbar.lenmode = 'fraction';
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-tick setings-%
colorbar.tickcolor = outlineColor;
@@ -94,7 +95,7 @@
colorbar.ticklen = tickLength;
colorbar.tickwidth = lineWidth;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-get colorbar title and labels-%
colorbarTitle = colorbarData.Label;
@@ -112,25 +113,25 @@
colorbarYLabelData = colorbarYLabel;
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-STANDARDIZE UNITS FOR TITLE-%
titleunits = colorbarTitleData.Units;
titlefontunits = colorbarTitleData.FontUnits;
ylabelunits = colorbarYLabelData.Units;
ylabelfontunits = colorbarYLabelData.FontUnits;
- set(colorbarTitle,'Units','data');
- set(colorbarYLabel,'Units','data');
- set(colorbarYLabel,'FontUnits','points');
+ set(colorbarTitle,'Units', 'data');
+ set(colorbarYLabel,'Units', 'data');
+ set(colorbarYLabel,'FontUnits', 'points');
if ~isHG2
xlabelunits = colorbarXLabelData.Units;
xlabelfontunits = colorbarXLabelData.FontUnits;
- set(colorbarTitle,'FontUnits','points');
- set(colorbarXLabel,'Units','data');
- set(colorbarXLabel,'FontUnits','points');
+ set(colorbarTitle,'FontUnits', 'points');
+ set(colorbarXLabel,'Units', 'data');
+ set(colorbarXLabel,'FontUnits', 'points');
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-colorbar title settings-%
isTitle = true;
@@ -146,7 +147,8 @@
end
titleFontSize = 1.20 * colorbarTitleData.FontSize;
- titleFontColor = sprintf('rgb(%f,%f,%f)', 255*colorbarTitleData.Color);
+ titleFontColor = ...
+ sprintf('rgb(%f,%f,%f)', 255*colorbarTitleData.Color);
titleFontFamily = matlab2plotlyfont(colorbarTitleData.FontName);
elseif ~isempty(colorbarXLabelData.String)
@@ -155,7 +157,8 @@
titleSide = 'right';
titleFontSize = 1.20 * colorbarXLabelData.FontSize;
- titleFontColor = sprintf('rgb(%f,%f,%f)', 255*colorbarXLabelData.Color);
+ titleFontColor = ...
+ sprintf('rgb(%f,%f,%f)', 255*colorbarXLabelData.Color);
titleFontFamily = matlab2plotlyfont(colorbarXLabelData.FontName);
elseif ~isempty(colorbarYLabelData.String)
@@ -164,7 +167,8 @@
titleSide = 'bottom';
titleFontSize = 1.20 * colorbarYLabelData.FontSize;
- titleFontColor = sprintf('rgb(%f,%f,%f)', 255*colorbarYLabelData.Color);
+ titleFontColor = ...
+ sprintf('rgb(%f,%f,%f)', 255*colorbarYLabelData.Color);
titleFontFamily = matlab2plotlyfont(colorbarYLabelData.FontName);
else
@@ -179,20 +183,20 @@
colorbar.titlefont.family = titleFontFamily;
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-REVERT UNITS FOR TITLE-%
- set(colorbarTitle,'Units',titleunits);
- set(colorbarTitle,'FontUnits',titlefontunits);
- set(colorbarYLabel,'Units',ylabelunits);
- set(colorbarYLabel,'FontUnits',ylabelfontunits);
+ set(colorbarTitle,'Units', titleunits);
+ set(colorbarTitle,'FontUnits', titlefontunits);
+ set(colorbarYLabel,'Units', ylabelunits);
+ set(colorbarYLabel,'FontUnits', ylabelfontunits);
if ~isHG2
- set(colorbarXLabel,'Units',xlabelunits);
- set(colorbarXLabel,'FontUnits',xlabelfontunits);
+ set(colorbarXLabel,'Units', xlabelunits);
+ set(colorbarXLabel,'FontUnits', xlabelfontunits);
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-tick labels-%
tickValues = colorbarData.Ticks;
@@ -235,7 +239,7 @@
colorbar = setTicksNotHG2(colorbar, colorbarData);
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-colorbar bg-color-%
if ~isHG2
@@ -248,27 +252,25 @@
obj.layout.plot_bgcolor = sprintf('rgb(%f,%f,%f', bgColor);
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-ASSOCIATED DATA-%
- if isfield(colorbarData.UserData,'dataref')
+ if isfield(colorbarData.UserData, 'dataref')
colorbarDataIndex = colorbarData.UserData.dataref;
else
- colorbarDataIndex = findColorbarData(obj,colorbarIndex,colorbarData);
+ colorbarDataIndex = ...
+ findColorbarData(obj,colorbarIndex, colorbarData);
end
obj.data{colorbarDataIndex}.colorbar = colorbar;
obj.data{colorbarDataIndex}.showscale = true;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-REVERT UNITS-%
- set(obj.State.Colorbar(colorbarIndex).Handle,'Units',colorbarUnits);
-
- %-------------------------------------------------------------------------%
+ set(obj.State.Colorbar(colorbarIndex).Handle, 'Units', colorbarUnits);
end
-
function colorbar = setTicksNotHG2(colorbar, colorbarData)
verticalOrientation = colorbar.len > colorbar.thickness;
@@ -285,12 +287,13 @@
case 'out'
colorbar.ticks = 'outside';
end
-
+
if strcmp(colorbarData.YTickLabelMode,'auto')
%-autotick-%
colorbar.autotick = true;
%-numticks-%
- colorbar.nticks = length(colorbarData.YTick) + 1; %nticks = max ticks (so + 1)
+ % nticks = max ticks (so + 1)
+ colorbar.nticks = length(colorbarData.YTick) + 1;
else
%-show tick labels-%
if isempty(colorbarData.YTickLabel)
@@ -299,9 +302,12 @@
%-autotick-%
colorbar.autotick = false;
%-tick0-%
- colorbar.tick0 = str2double(colorbarData.YTickLabel(1,:));
+ colorbar.tick0 = ...
+ str2double(colorbarData.YTickLabel(1,:));
%-dtick-%
- colorbar.dtick = str2double(colorbarData.YTickLabel(2,:)) - str2double(colorbarData.YTickLabel(1,:));
+ colorbar.dtick = ...
+ str2double(colorbarData.YTickLabel(2,:)) ...
+ - str2double(colorbarData.YTickLabel(1,:));
end
end
end
@@ -318,7 +324,7 @@
case 'out'
colorbar.ticks = 'outside';
end
-
+
if strcmp(colorbarData.XTickLabelMode,'auto')
%-autotick-%
colorbar.autotick = true;
@@ -332,12 +338,14 @@
%-autotick-%
colorbar.autotick = false;
%-tick0-%
- colorbar.tick0 = str2double(colorbarData.XTickLabel(1,:));
+ colorbar.tick0 = ...
+ str2double(colorbarData.XTickLabel(1,:));
%-dtick-%
- colorbar.dtick = str2double(colorbarData.XTickLabel(2,:)) - str2double(colorbarData.XTickLabel(1,:));
+ colorbar.dtick = ...
+ str2double(colorbarData.XTickLabel(2,:)) ...
+ - str2double(colorbarData.XTickLabel(1,:));
end
end
end
end
end
-
diff --git a/plotly/plotlyfig_aux/core/updateConstantLine.m b/plotly/plotlyfig_aux/core/updateConstantLine.m
index 50159a8d..9a62985f 100644
--- a/plotly/plotlyfig_aux/core/updateConstantLine.m
+++ b/plotly/plotlyfig_aux/core/updateConstantLine.m
@@ -1,6 +1,4 @@
function updateConstantLine(obj,plotIndex)
- %---------------------------------------------------------------------%
-
%-AXIS INDEX-%
axIndex = obj.getAxisIndex(obj.State.Plot(plotIndex).AssociatedAxis);
@@ -8,7 +6,7 @@ function updateConstantLine(obj,plotIndex)
plotData = obj.State.Plot(plotIndex).Handle;
%-CHECK FOR MULTIPLE AXES-%
- [xsource, ysource] = findSourceAxis(obj,axIndex);
+ [xsource, ysource] = findSourceAxis(obj, axIndex);
%---------------------------------------------------------------------%
@@ -28,7 +26,7 @@ function updateConstantLine(obj,plotIndex)
%---------------------------------------------------------------------%
%-scatter visible-%
- obj.data{plotIndex}.visible = strcmp(plotData.Visible,"on");
+ obj.data{plotIndex}.visible = strcmp(plotData.Visible, "on");
%---------------------------------------------------------------------%
@@ -51,9 +49,7 @@ function updateConstantLine(obj,plotIndex)
obj.PlotOptions.is3d = false; % by default
if isfield(plotData,"ZData")
-
numbset = unique(plotData.ZData);
-
if any(plotData.ZData) && length(numbset)>1
%-scatter z-%
obj.data{plotIndex}.z = plotData.ZData;
diff --git a/plotly/plotlyfig_aux/core/updateFigure.m b/plotly/plotlyfig_aux/core/updateFigure.m
index 9219aba1..908c1640 100644
--- a/plotly/plotlyfig_aux/core/updateFigure.m
+++ b/plotly/plotlyfig_aux/core/updateFigure.m
@@ -52,7 +52,7 @@
%-------------------------------------------------------------------------%
%-figure show legend-%
-if(obj.State.Figure.NumLegends > 1)
+if (obj.State.Figure.NumLegends > 1)
obj.layout.showlegend = true;
else
obj.layout.showlegend = false;
diff --git a/plotly/plotlyfig_aux/core/updateHeatmapAnnotation.m b/plotly/plotlyfig_aux/core/updateHeatmapAnnotation.m
index 808105f9..c4e91585 100644
--- a/plotly/plotlyfig_aux/core/updateHeatmapAnnotation.m
+++ b/plotly/plotlyfig_aux/core/updateHeatmapAnnotation.m
@@ -1,101 +1,97 @@
function obj = updateHeatmapAnnotation(obj,anIndex)
-
-%-------X/YLABEL FIELDS--------%
-% title...[DONE]
-% titlefont.size...[DONE]
-% titlefont.family...[DONE]
-% titlefont.color...[DONE]
-
-%------ANNOTATION FIELDS-------%
-
-% x: ...[DONE]
-% y: ...[DONE]
-% xref: ...[DONE]
-% yref: ...[DONE]
-% text: ...[DONE]
-% showarrow: ...[HANDLED BY CALL TO ANNOTATION];
-% font: ...[DONE]
-% xanchor: ...[DONE]
-% yanchor: ...[DONE]
-% align: ...[DONE]
-% arrowhead: ...[HANDLED BY CALL FROM ANNOTATION];
-% arrowsize: ...[HANDLED BY CALL FROM ANNOTATION];
-% arrowwidth: ...[HANDLED BY CALL FROM ANNOTATION];
-% arrowcolor: ...[HANDLED BY CALL FROM ANNOTATION];
-% ax: ...[HANDLED BY CALL FROM ANNOTATION];
-% ay: ...[HANDLED BY CALL FROM ANNOTATION];
-% textangle: ...[DONE]
-% bordercolor: ...[DONE]
-% borderwidth: ...[DONE]
-% borderpad: ...[DONE]
-% bgcolor: ...[DONE]
-% opacity: ...[NOT SUPPORTED IN MATLAB]
-
-
-%-AXIS INDEX-%
-nanns = length(obj.layout.annotations);
-axIndex = nanns + obj.getAxisIndex(obj.State.Text(anIndex).AssociatedAxis);
-
-%-CHECK FOR MULTIPLE AXES-%
-[xsource, ysource] = findSourceAxis(obj,anIndex);
-
-%-get heatmap title name-%
-title_name = obj.State.Text(anIndex).Handle;
-
-%-show arrow-%
-obj.layout.annotations{axIndex}.showarrow = false;
-
-%-------------------------------------------------------------------------%
-
-%-anchor title to paper-%
-if obj.State.Text(anIndex).Title
- %-xref-%
- obj.layout.annotations{axIndex}.xref = 'paper';
- %-yref-%
- obj.layout.annotations{axIndex}.yref = 'paper';
-else
- %-xref-%
- obj.layout.annotations{axIndex}.xref = ['x' num2str(xsource)];
- %-yref-%
- obj.layout.annotations{axIndex}.yref = ['y' num2str(ysource)];
-end
-
-%-------------------------------------------------------------------------%
-
-%-xanchor-%
-obj.layout.annotations{axIndex}.xanchor = 'middle';
-
-%-align-%
-obj.layout.annotations{axIndex}.align = 'middle';
-
-%-xanchor-%
-obj.layout.annotations{axIndex}.yanchor = 'top';
-
-
-%-------------------------------------------------------------------------%
-
-%-text-%
-obj.layout.annotations{axIndex}.text = sprintf('%s', title_name);
-obj.layout.annotations{axIndex}.font.size = 14;
-
-%-------------------------------------------------------------------------%
-
-if obj.State.Text(anIndex).Title
-
- %-AXIS DATA-%
- xaxis = obj.layout.("xaxis" + xsource);
- yaxis = obj.layout.("yaxis" + ysource);
-
- %-x position-%
- obj.layout.annotations{axIndex}.x = mean(xaxis.domain);
- %-y position-%
- obj.layout.annotations{axIndex}.y = (yaxis.domain(2) + 0.04);
-else
- %-x position-%
- obj.layout.annotations{axIndex}.x = text_data.Position(1);
- %-y position-%
- obj.layout.annotations{axIndex}.y = text_data.Position(2);
-end
-
-%-------------------------------------------------------------------------%
+ %-------X/YLABEL FIELDS--------%
+ % title...[DONE]
+ % titlefont.size...[DONE]
+ % titlefont.family...[DONE]
+ % titlefont.color...[DONE]
+
+ %------ANNOTATION FIELDS-------%
+
+ % x: ...[DONE]
+ % y: ...[DONE]
+ % xref: ...[DONE]
+ % yref: ...[DONE]
+ % text: ...[DONE]
+ % showarrow: ...[HANDLED BY CALL TO ANNOTATION];
+ % font: ...[DONE]
+ % xanchor: ...[DONE]
+ % yanchor: ...[DONE]
+ % align: ...[DONE]
+ % arrowhead: ...[HANDLED BY CALL FROM ANNOTATION];
+ % arrowsize: ...[HANDLED BY CALL FROM ANNOTATION];
+ % arrowwidth: ...[HANDLED BY CALL FROM ANNOTATION];
+ % arrowcolor: ...[HANDLED BY CALL FROM ANNOTATION];
+ % ax: ...[HANDLED BY CALL FROM ANNOTATION];
+ % ay: ...[HANDLED BY CALL FROM ANNOTATION];
+ % textangle: ...[DONE]
+ % bordercolor: ...[DONE]
+ % borderwidth: ...[DONE]
+ % borderpad: ...[DONE]
+ % bgcolor: ...[DONE]
+ % opacity: ...[NOT SUPPORTED IN MATLAB]
+
+
+ %-AXIS INDEX-%
+ nanns = length(obj.layout.annotations);
+ axIndex = nanns + obj.getAxisIndex(obj.State.Text(anIndex).AssociatedAxis);
+
+ %-CHECK FOR MULTIPLE AXES-%
+ [xsource, ysource] = findSourceAxis(obj,anIndex);
+
+ %-get heatmap title name-%
+ title_name = obj.State.Text(anIndex).Handle;
+
+ %-show arrow-%
+ obj.layout.annotations{axIndex}.showarrow = false;
+
+ %---------------------------------------------------------------------%
+
+ %-anchor title to paper-%
+ if obj.State.Text(anIndex).Title
+ %-xref-%
+ obj.layout.annotations{axIndex}.xref = 'paper';
+ %-yref-%
+ obj.layout.annotations{axIndex}.yref = 'paper';
+ else
+ %-xref-%
+ obj.layout.annotations{axIndex}.xref = ['x' num2str(xsource)];
+ %-yref-%
+ obj.layout.annotations{axIndex}.yref = ['y' num2str(ysource)];
+ end
+
+ %---------------------------------------------------------------------%
+
+ %-xanchor-%
+ obj.layout.annotations{axIndex}.xanchor = 'middle';
+
+ %-align-%
+ obj.layout.annotations{axIndex}.align = 'middle';
+
+ %-xanchor-%
+ obj.layout.annotations{axIndex}.yanchor = 'top';
+
+
+ %---------------------------------------------------------------------%
+
+ %-text-%
+ obj.layout.annotations{axIndex}.text = sprintf('%s', title_name);
+ obj.layout.annotations{axIndex}.font.size = 14;
+
+ %---------------------------------------------------------------------%
+
+ if obj.State.Text(anIndex).Title
+ %-AXIS DATA-%
+ xaxis = obj.layout.("xaxis" + xsource);
+ yaxis = obj.layout.("yaxis" + ysource);
+
+ %-x position-%
+ obj.layout.annotations{axIndex}.x = mean(xaxis.domain);
+ %-y position-%
+ obj.layout.annotations{axIndex}.y = (yaxis.domain(2) + 0.04);
+ else
+ %-x position-%
+ obj.layout.annotations{axIndex}.x = text_data.Position(1);
+ %-y position-%
+ obj.layout.annotations{axIndex}.y = text_data.Position(2);
+ end
end
\ No newline at end of file
diff --git a/plotly/plotlyfig_aux/core/updateLegend.m b/plotly/plotlyfig_aux/core/updateLegend.m
index c3adba0e..2bb94fca 100644
--- a/plotly/plotlyfig_aux/core/updateLegend.m
+++ b/plotly/plotlyfig_aux/core/updateLegend.m
@@ -1,112 +1,107 @@
function obj = updateLegend(obj, legIndex)
+ % x: ...[DONE]
+ % y: ...[DONE]
+ % traceorder: ...[DONE]
+ % font: ...[DONE]
+ % bgcolor: ...[DONE]
+ % bordercolor: ...[DONE]
+ % borderwidth: ...[DONE]
+ % xref: ...[DONE]
+ % yref: ...[DONE]
+ % xanchor: ...[DONE]
+ % yanchor: ...[DONE]
+
+ %-STANDARDIZE UNITS-%
+ legendunits = obj.State.Legend(legIndex).Handle.Units;
+ fontunits = obj.State.Legend(legIndex).Handle.FontUnits;
+ set(obj.State.Legend(legIndex).Handle, 'Units', 'normalized');
+ set(obj.State.Legend(legIndex).Handle, 'FontUnits', 'points');
+
+ %-LEGEND DATA STRUCTURE-%
+ legend_data = obj.State.Legend(legIndex).Handle;
+
+ % only displays last legend as global Plotly legend
+ obj.layout.legend = struct();
-% x: ...[DONE]
-% y: ...[DONE]
-% traceorder: ...[DONE]
-% font: ...[DONE]
-% bgcolor: ...[DONE]
-% bordercolor: ...[DONE]
-% borderwidth: ...[DONE]
-% xref: ...[DONE]
-% yref: ...[DONE]
-% xanchor: ...[DONE]
-% yanchor: ...[DONE]
-
-%-STANDARDIZE UNITS-%
-legendunits = obj.State.Legend(legIndex).Handle.Units;
-fontunits = obj.State.Legend(legIndex).Handle.FontUnits;
-set(obj.State.Legend(legIndex).Handle,'Units','normalized');
-set(obj.State.Legend(legIndex).Handle,'FontUnits','points');
-
-%-LEGEND DATA STRUCTURE-%
-legend_data = obj.State.Legend(legIndex).Handle;
-
-% only displays last legend as global Plotly legend
-obj.layout.legend = struct();
-
-%-------------------------------------------------------------------------%
-
-%-layout showlegend-%
-obj.layout.showlegend = strcmpi(legend_data.Visible,'on');
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-layout showlegend-%
+ obj.layout.showlegend = strcmpi(legend_data.Visible,'on');
-%-legend x-%
-obj.layout.legend.x = legend_data.Position(1);
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-legend x-%
+ obj.layout.legend.x = legend_data.Position(1);
-%-legend xref-%
-obj.layout.legend.xref = 'paper';
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-legend xref-%
+ obj.layout.legend.xref = 'paper';
-%-legend xanchor-%
-obj.layout.legend.xanchor = 'left';
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-legend xanchor-%
+ obj.layout.legend.xanchor = 'left';
-%-legend y-%
-obj.layout.legend.y = legend_data.Position(2);
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-legend y-%
+ obj.layout.legend.y = legend_data.Position(2);
-%-legend yref-%
-obj.layout.legend.yref = 'paper';
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-legend yref-%
+ obj.layout.legend.yref = 'paper';
-%-legend yanchor-%
-obj.layout.legend.yanchor = 'bottom';
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-legend yanchor-%
+ obj.layout.legend.yanchor = 'bottom';
-if (strcmp(legend_data.Box,'on') && strcmp(legend_data.Visible, 'on'))
-
- %---------------------------------------------------------------------%
-
- %-legend traceorder-%
- obj.layout.legend.traceorder = 'normal';
-
- %---------------------------------------------------------------------%
-
- %-legend borderwidth-%
- obj.layout.legend.borderwidth = legend_data.LineWidth;
-
- %---------------------------------------------------------------------%
-
- %-legend bordercolor-%
- col = 255*legend_data.EdgeColor;
- obj.layout.legend.bordercolor = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];
-
%---------------------------------------------------------------------%
-
- %-legend bgcolor-%
- col = 255*legend_data.Color;
- obj.layout.legend.bgcolor = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];
-
- %---------------------------------------------------------------------%
-
- %-legend font size-%
- obj.layout.legend.font.size = legend_data.FontSize;
-
- %---------------------------------------------------------------------%
-
- %-legend font family-%
- obj.layout.legend.font.family = matlab2plotlyfont(legend_data.FontName);
-
- %---------------------------------------------------------------------%
-
- %-legend font colour-%
- col = 255*legend_data.TextColor;
- obj.layout.legend.font.color = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) '_)'];
-
-end
-%-------------------------------------------------------------------------%
+ if (strcmp(legend_data.Box,'on') && strcmp(legend_data.Visible, 'on'))
+ %-legend traceorder-%
+ obj.layout.legend.traceorder = 'normal';
+
+ %-----------------------------------------------------------------%
+
+ %-legend borderwidth-%
+ obj.layout.legend.borderwidth = legend_data.LineWidth;
+
+ %-----------------------------------------------------------------%
+
+ %-legend bordercolor-%
+ col = 255*legend_data.EdgeColor;
+ obj.layout.legend.bordercolor = sprintf("rgb(%f,%f,%f)", col);
+
+ %-----------------------------------------------------------------%
+
+ %-legend bgcolor-%
+ col = 255*legend_data.Color;
+ obj.layout.legend.bgcolor = sprintf("rgb(%f,%f,%f)", col);
+
+ %-----------------------------------------------------------------%
+
+ %-legend font size-%
+ obj.layout.legend.font.size = legend_data.FontSize;
+
+ %-----------------------------------------------------------------%
+
+ %-legend font family-%
+ obj.layout.legend.font.family = ...
+ matlab2plotlyfont(legend_data.FontName);
+
+ %-----------------------------------------------------------------%
+
+ %-legend font colour-%
+ col = 255*legend_data.TextColor;
+ obj.layout.legend.font.color = sprintf("rgb(%f,%f,%f)", col);
+ end
-%-REVERT UNITS-%
-set(obj.State.Legend(legIndex).Handle,'Units',legendunits);
-set(obj.State.Legend(legIndex).Handle,'FontUnits',fontunits);
+ %---------------------------------------------------------------------%
+ %-REVERT UNITS-%
+ set(obj.State.Legend(legIndex).Handle,'Units',legendunits);
+ set(obj.State.Legend(legIndex).Handle,'FontUnits',fontunits);
end
diff --git a/plotly/plotlyfig_aux/core/updateLegendMultipleAxes.m b/plotly/plotlyfig_aux/core/updateLegendMultipleAxes.m
index 6cbe7fbc..61f78b9a 100644
--- a/plotly/plotlyfig_aux/core/updateLegendMultipleAxes.m
+++ b/plotly/plotlyfig_aux/core/updateLegendMultipleAxes.m
@@ -1,127 +1,124 @@
function obj = updateLegendMultipleAxes(obj, legIndex)
+ % x: ...[DONE]
+ % y: ...[DONE]
+ % traceorder: ...[DONE]
+ % font: ...[DONE]
+ % bgcolor: ...[DONE]
+ % bordercolor: ...[DONE]
+ % borderwidth: ...[DONE]
+ % xref: ...[DONE]
+ % yref: ...[DONE]
+ % xanchor: ...[DONE]
+ % yanchor: ...[DONE]
+
+ %=====================================================================%
+ %
+ %-GET NECESSARY INFO FOR MULTIPLE LEGENDS-%
+ %
+ %=====================================================================%
+
+ for traceIndex = 1:obj.State.Figure.NumPlots
+ allNames{traceIndex} = obj.data{traceIndex}.name;
+ allShowLegens(traceIndex) = obj.data{traceIndex}.showlegend;
+ obj.data{traceIndex}.showlegend = false;
+ obj.data{traceIndex}.legendgroup = obj.data{traceIndex}.name;
+
+ axIndex = obj.getAxisIndex( ...
+ obj.State.Plot(traceIndex).AssociatedAxis);
+ [xSource, ySource] = findSourceAxis(obj, axIndex);
+ xAxis = obj.layout.("xaxis" + xSource);
+ yAxis = obj.layout.("yaxis" + xSource);
+
+ allDomain(traceIndex, 1) = max(xAxis.domain);
+ allDomain(traceIndex, 2) = max(yAxis.domain);
+ end
+
+ [~, groupIndex] = unique(allNames);
+
+ for traceIndex = groupIndex'
+ obj.data{traceIndex}.showlegend = allShowLegens(traceIndex);
+ end
-% x: ...[DONE]
-% y: ...[DONE]
-% traceorder: ...[DONE]
-% font: ...[DONE]
-% bgcolor: ...[DONE]
-% bordercolor: ...[DONE]
-% borderwidth: ...[DONE]
-% xref: ...[DONE]
-% yref: ...[DONE]
-% xanchor: ...[DONE]
-% yanchor: ...[DONE]
-
-%=========================================================================%
-%
-%-GET NECESSARY INFO FOR MULTIPLE LEGENDS-%
-%
-%=========================================================================%
-
-for traceIndex = 1:obj.State.Figure.NumPlots
- allNames{traceIndex} = obj.data{traceIndex}.name;
- allShowLegens(traceIndex) = obj.data{traceIndex}.showlegend;
- obj.data{traceIndex}.showlegend = false;
- obj.data{traceIndex}.legendgroup = obj.data{traceIndex}.name;
-
- axIndex = obj.getAxisIndex(obj.State.Plot(traceIndex).AssociatedAxis);
- [xSource, ySource] = findSourceAxis(obj, axIndex);
- xAxis = obj.layout.("xaxis" + xSource);
- yAxis = obj.layout.("yaxis" + xSource);
-
- allDomain(traceIndex, 1) = max(xAxis.domain);
- allDomain(traceIndex, 2) = max(yAxis.domain);
-end
-
-[~, groupIndex] = unique(allNames);
-
-for traceIndex = groupIndex'
- obj.data{traceIndex}.showlegend = allShowLegens(traceIndex);
-end
-
-%-------------------------------------------------------------------------%
-
-%-STANDARDIZE UNITS-%
-legendUnits = obj.State.Legend(legIndex).Handle.Units;
-fontUnits = obj.State.Legend(legIndex).Handle.FontUnits;
-set(obj.State.Legend(legIndex).Handle,'Units','normalized');
-set(obj.State.Legend(legIndex).Handle,'FontUnits','points');
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-STANDARDIZE UNITS-%
+ legendUnits = obj.State.Legend(legIndex).Handle.Units;
+ fontUnits = obj.State.Legend(legIndex).Handle.FontUnits;
+ set(obj.State.Legend(legIndex).Handle,'Units','normalized');
+ set(obj.State.Legend(legIndex).Handle,'FontUnits','points');
-%-LEGEND DATA STRUCTURE-%
-legendData = obj.State.Legend(legIndex).Handle;
+ %---------------------------------------------------------------------%
-% only displays last legend as global Plotly legend
-obj.layout.legend = struct();
+ %-LEGEND DATA STRUCTURE-%
+ legendData = obj.State.Legend(legIndex).Handle;
-%-------------------------------------------------------------------------%
+ % only displays last legend as global Plotly legend
+ obj.layout.legend = struct();
-%-layout showlegend-%
-obj.layout.showlegend = strcmpi(legendData.Visible,'on');
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-layout showlegend-%
+ obj.layout.showlegend = strcmpi(legendData.Visible,'on');
-%-legend (x,y) coordenates-%
-obj.layout.legend.x = 1.005 * max(allDomain(:,1));
-obj.layout.legend.y = 1.001 * max(allDomain(:,2));;
+ %---------------------------------------------------------------------%
-%-legend (x,y) refs-%
-obj.layout.legend.xref = 'paper';
-obj.layout.legend.yref = 'paper';
+ %-legend (x,y) coordenates-%
+ obj.layout.legend.x = 1.005 * max(allDomain(:,1));
+ obj.layout.legend.y = 1.001 * max(allDomain(:,2));;
-%-legend (x,y) anchors-%
-obj.layout.legend.xanchor = 'left';
-obj.layout.legend.yanchor = 'top';
+ %-legend (x,y) refs-%
+ obj.layout.legend.xref = 'paper';
+ obj.layout.legend.yref = 'paper';
-%-------------------------------------------------------------------------%
+ %-legend (x,y) anchors-%
+ obj.layout.legend.xanchor = 'left';
+ obj.layout.legend.yanchor = 'top';
-if (strcmp(legendData.Box,'on') && strcmp(legendData.Visible, 'on'))
-
- %---------------------------------------------------------------------%
-
- %-legend traceorder-%
- obj.layout.legend.traceorder = 'normal';
-
- %---------------------------------------------------------------------%
-
- %-legend borderwidth-%
- obj.layout.legend.borderwidth = legendData.LineWidth;
-
- %---------------------------------------------------------------------%
-
- %-legend bordercolor-%
- col = 255*legendData.EdgeColor;
- obj.layout.legend.bordercolor = sprintf('rgb(%f,%f,%f)', col);
-
- %---------------------------------------------------------------------%
-
- %-legend bgcolor-%
- col = 255*legendData.Color;
- obj.layout.legend.bgcolor = sprintf('rgb(%f,%f,%f)', col);
-
%---------------------------------------------------------------------%
-
- %-legend font size-%
- obj.layout.legend.font.size = legendData.FontSize;
-
- %---------------------------------------------------------------------%
-
- %-legend font family-%
- obj.layout.legend.font.family = matlab2plotlyfont(legendData.FontName);
-
- %---------------------------------------------------------------------%
-
- %-legend font colour-%
- col = 255*legendData.TextColor;
- obj.layout.legend.font.color = sprintf('rgb(%f,%f,%f)', col);
-
-end
-%-------------------------------------------------------------------------%
+ if (strcmp(legendData.Box,'on') && strcmp(legendData.Visible, 'on'))
+ %-legend traceorder-%
+ obj.layout.legend.traceorder = 'normal';
+
+ %-----------------------------------------------------------------%
+
+ %-legend borderwidth-%
+ obj.layout.legend.borderwidth = legendData.LineWidth;
+
+ %-----------------------------------------------------------------%
+
+ %-legend bordercolor-%
+ col = 255*legendData.EdgeColor;
+ obj.layout.legend.bordercolor = sprintf('rgb(%f,%f,%f)', col);
+
+ %-----------------------------------------------------------------%
+
+ %-legend bgcolor-%
+ col = 255*legendData.Color;
+ obj.layout.legend.bgcolor = sprintf('rgb(%f,%f,%f)', col);
+
+ %-----------------------------------------------------------------%
+
+ %-legend font size-%
+ obj.layout.legend.font.size = legendData.FontSize;
+
+ %-----------------------------------------------------------------%
+
+ %-legend font family-%
+ obj.layout.legend.font.family = ...
+ matlab2plotlyfont(legendData.FontName);
+
+ %-----------------------------------------------------------------%
+
+ %-legend font colour-%
+ col = 255*legendData.TextColor;
+ obj.layout.legend.font.color = sprintf('rgb(%f,%f,%f)', col);
+
+ end
-%-REVERT UNITS-%
-set(obj.State.Legend(legIndex).Handle,'Units',legendUnits);
-set(obj.State.Legend(legIndex).Handle,'FontUnits',fontUnits);
+ %---------------------------------------------------------------------%
+ %-REVERT UNITS-%
+ set(obj.State.Legend(legIndex).Handle,'Units', legendUnits);
+ set(obj.State.Legend(legIndex).Handle,'FontUnits', fontUnits);
end
diff --git a/plotly/plotlyfig_aux/core/updateTernaryColorbar.m b/plotly/plotlyfig_aux/core/updateTernaryColorbar.m
index a705cd6f..70e206ba 100644
--- a/plotly/plotlyfig_aux/core/updateTernaryColorbar.m
+++ b/plotly/plotlyfig_aux/core/updateTernaryColorbar.m
@@ -1,363 +1,368 @@
function obj = updateTernaryColorbar(obj,colorbarIndex)
+ % title: ...[DONE]
+ % titleside: ...[DONE]
+ % titlefont: ...[DONE]
+ % thickness: ...[DONE]
+ % thicknessmode: ...[DONE]
+ % len: ...[DONE]
+ % lenmode: ...[DONE]
+ % x: ...[DONE]
+ % y: ...[DONE]
+ % autotick: ...[DONE]
+ % nticks: ...[DONE]
+ % ticks: ...[DONE]
+ % showticklabels: ...[DONE]
+ % tick0: ...[DONE]
+ % dtick: ...[DONE]
+ % ticklen: ...[DONE]
+ % tickwidth: ...[DONE]
+ % tickcolor: ...[DONE]
+ % tickangle: ...[NOT SUPPORTED IN MATLAB]
+ % tickfont: ...[DONE]
+ % exponentformat: ...[DONE]
+ % showexponent: ...[NOT SUPPORTED IN MATLAB]
+ % xanchor: ...[DONE]
+ % yanchor: ...[DONE]
+ % bgcolor: ...[DONE]
+ % outlinecolor: ...[DONE]
+ % outlinewidth: ...[DONE]
+ % borderwidth: ...[NOT SUPPORTED IN MATLAB]
+ % bordercolor: ...[NOT SUPPORTED IN MATLAB]
+ % xpad: ...[DONE]
+ % ypad: ...[DONE]
+
+ %-FIGURE STRUCTURE-%
+ figureData = obj.State.Figure.Handle;
+
+ %-PLOT DATA STRUCTURE- %
+ try
+ colorbarData = obj.State.Colorbar(colorbarIndex).Handle;
+ catch
+ disp('could not extract ColorBar data');
+ end
-% title: ...[DONE]
-% titleside: ...[DONE]
-% titlefont: ...[DONE]
-% thickness: ...[DONE]
-% thicknessmode: ...[DONE]
-% len: ...[DONE]
-% lenmode: ...[DONE]
-% x: ...[DONE]
-% y: ...[DONE]
-% autotick: ...[DONE]
-% nticks: ...[DONE]
-% ticks: ...[DONE]
-% showticklabels: ...[DONE]
-% tick0: ...[DONE]
-% dtick: ...[DONE]
-% ticklen: ...[DONE]
-% tickwidth: ...[DONE]
-% tickcolor: ...[DONE]
-% tickangle: ...[NOT SUPPORTED IN MATLAB]
-% tickfont: ...[DONE]
-% exponentformat: ...[DONE]
-% showexponent: ...[NOT SUPPORTED IN MATLAB]
-% xanchor: ...[DONE]
-% yanchor: ...[DONE]
-% bgcolor: ...[DONE]
-% outlinecolor: ...[DONE]
-% outlinewidth: ...[DONE]
-% borderwidth: ...[NOT SUPPORTED IN MATLAB]
-% bordercolor: ...[NOT SUPPORTED IN MATLAB]
-% xpad: ...[DONE]
-% ypad: ...[DONE]
-
-%-FIGURE STRUCTURE-%
-figureData = obj.State.Figure.Handle;
-
-%-PLOT DATA STRUCTURE- %
-try
- colorbarData = obj.State.Colorbar(colorbarIndex).Handle;
-catch
- disp('could not extract ColorBar data');
-end
-
-%-STANDARDIZE UNITS-%
-colorbarunits = colorbarData.Units;
-set(obj.State.Colorbar(colorbarIndex).Handle,'Units','normalized');
+ %-STANDARDIZE UNITS-%
+ colorbarunits = colorbarData.Units;
+ set(obj.State.Colorbar(colorbarIndex).Handle, 'Units', 'normalized');
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-colorbar position-%
-colorbar.xanchor = 'left';
-colorbar.yanchor = 'bottom';
-colorbar.x = colorbarData.Position(1)*1.025;
-colorbar.y = colorbarData.Position(2);
+ %-colorbar position-%
+ colorbar.xanchor = 'left';
+ colorbar.yanchor = 'bottom';
+ colorbar.x = colorbarData.Position(1)*1.025;
+ colorbar.y = colorbarData.Position(2);
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-exponent format-%
-colorbar.exponentformat = obj.PlotlyDefaults.ExponentFormat;
+ %-exponent format-%
+ colorbar.exponentformat = obj.PlotlyDefaults.ExponentFormat;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-% get colorbar title and labels
-colorbarTitle = colorbarData.Label;
+ % get colorbar title and labels
+ colorbarTitle = colorbarData.Label;
-if isHG2
- colorbarTitleData = colorbarTitle;
- colorbarYLabel = colorbarTitle;
- colorbarYLabelData = colorbarTitle;
- colorbarXLabelData.String = [];
-else
- colorbarTitleData = colorbarTitle;
- colorbarXLabel = colorbarData.XLabel;
- colorbarXLabelData = colorbarXLabel;
- colorbarYLabel = colorbarData.YLabel;
- colorbarYLabelData = colorbarYLabel;
-end
+ if isHG2
+ colorbarTitleData = colorbarTitle;
+ colorbarYLabel = colorbarTitle;
+ colorbarYLabelData = colorbarTitle;
+ colorbarXLabelData.String = [];
+ else
+ colorbarTitleData = colorbarTitle;
+ colorbarXLabel = colorbarData.XLabel;
+ colorbarXLabelData = colorbarXLabel;
+ colorbarYLabel = colorbarData.YLabel;
+ colorbarYLabelData = colorbarYLabel;
+ end
-%-colorbar title-%
-if ~isempty(colorbarTitleData.String)
- colorbar.title = parseString(colorbarTitleData.String,colorbarTitleData.Interpreter);
+ %-colorbar title-%
+ if ~isempty(colorbarTitleData.String)
+ colorbar.title = parseString(colorbarTitleData.String, ...
+ colorbarTitleData.Interpreter);
+ elseif ~isempty(colorbarXLabelData.String)
+ colorbar.title = parseString(colorbarXLabelData.String, ...
+ colorbarXLabelData.Interpreter);
+ elseif ~isempty(colorbarYLabelData.String)
+ colorbar.title = parseString(colorbarYLabelData.String, ...
+ colorbarYLabelData.Interpreter);
+ end
-elseif ~isempty(colorbarXLabelData.String)
- colorbar.title = parseString(colorbarXLabelData.String,colorbarXLabelData.Interpreter);
-elseif ~isempty(colorbarYLabelData.String)
- colorbar.title = parseString(colorbarYLabelData.String,colorbarYLabelData.Interpreter);
-end
+ %---------------------------------------------------------------------%
+ %-STANDARDIZE UNITS-%
+ titleUnits = colorbarTitleData.Units;
+ titleFontUnits = colorbarTitleData.FontUnits;
+ yLabelUnits = colorbarYLabelData.Units;
+ yLabelFontUnits = colorbarYLabelData.FontUnits;
+ set(colorbarTitle, 'Units', 'data');
+ set(colorbarYLabel, 'Units',' data');
+ set(colorbarYLabel, 'FontUnits', 'points');
-%-------------------------------------------------------------------------%
+ if ~isHG2
+ xLabelUnits = colorbarXLabelData.Units;
+ xLabelFontUnits = colorbarXLabelData.FontUnits;
+ set(colorbarTitle, 'FontUnits', 'points');
+ set(colorbarXLabel, 'Units', 'data');
+ set(colorbarXLabel, 'FontUnits', 'points');
+ end
-%-STANDARDIZE UNITS-%
-titleUnits = colorbarTitleData.Units;
-titleFontUnits = colorbarTitleData.FontUnits;
-yLabelUnits = colorbarYLabelData.Units;
-yLabelFontUnits = colorbarYLabelData.FontUnits;
-set(colorbarTitle,'Units','data');
-set(colorbarYLabel,'Units','data');
-set(colorbarYLabel,'FontUnits','points');
+ if ~isempty(colorbarTitleData.String)
+ if colorbarTitleData.Rotation == 90
+ colorbar.titleside = 'right';
+ else
+ colorbar.titleside = 'top';
+ end
-if ~isHG2
- xLabelUnits = colorbarXLabelData.Units;
- xLabelFontUnits = colorbarXLabelData.FontUnits;
- set(colorbarTitle,'FontUnits','points');
- set(colorbarXLabel,'Units','data');
- set(colorbarXLabel,'FontUnits','points');
-end
+ colorbar.titlefont.family = ...
+ matlab2plotlyfont(colorbarTitleData.FontName);
+ col = 255*colorbarTitleData.Color;
+ colorbar.titlefont.color = sprintf('rgb(%f,%f,%f)', col);
+ colorbar.titlefont.size = 1.20 * colorbarTitleData.FontSize;
-if ~isempty(colorbarTitleData.String)
- if colorbarTitleData.Rotation == 90
+ elseif ~isempty(colorbarXLabelData.String)
colorbar.titleside = 'right';
- else
- colorbar.titleside = 'top';
+ colorbar.titlefont.family = ...
+ matlab2plotlyfont(colorbarXLabelData.FontName);
+ col = 255*colorbarXLabelData.Color;
+ colorbar.titlefont.color = sprintf('rgb(%f,%f,%f)', col);
+ colorbar.titlefont.size = 1.20 * colorbarXLabelData.FontSize;
+
+ elseif ~isempty(colorbarYLabelData.String)
+ colorbar.titleside = 'bottom';
+ colorbar.titlefont.family = ...
+ matlab2plotlyfont(colorbarYLabelData.FontName);
+ col = 255*colorbarYLabelData.Color;
+ colorbar.titlefont.color = sprintf('rgb(%f,%f,%f)', col);
+ colorbar.titlefont.size = 1.20 * colorbarYLabelData.FontSize;
end
- colorbar.titlefont.family = matlab2plotlyfont(colorbarTitleData.FontName);
- col = 255*colorbarTitleData.Color;
- colorbar.titlefont.color = sprintf('rgb(%f,%f,%f)', col);
- colorbar.titlefont.size = 1.20 * colorbarTitleData.FontSize;
-
-elseif ~isempty(colorbarXLabelData.String)
- colorbar.titleside = 'right';
- colorbar.titlefont.family = matlab2plotlyfont(colorbarXLabelData.FontName);
- col = 255*colorbarXLabelData.Color;
- colorbar.titlefont.color = sprintf('rgb(%f,%f,%f)', col);
- colorbar.titlefont.size = 1.20 * colorbarXLabelData.FontSize;
-
-elseif ~isempty(colorbarYLabelData.String)
- colorbar.titleside = 'bottom';
- colorbar.titlefont.family = matlab2plotlyfont(colorbarYLabelData.FontName);
- col = 255*colorbarYLabelData.Color;
- colorbar.titlefont.color = sprintf('rgb(%f,%f,%f)', col);
- colorbar.titlefont.size = 1.20 * colorbarYLabelData.FontSize;
-end
-
-%-REVERT UNITS-%
-set(colorbarTitle,'Units',titleUnits);
-set(colorbarTitle,'FontUnits',titleFontUnits);
-set(colorbarYLabel,'Units',yLabelUnits);
-set(colorbarYLabel,'FontUnits',yLabelFontUnits);
+ %-REVERT UNITS-%
+ set(colorbarTitle, 'Units', titleUnits);
+ set(colorbarTitle, 'FontUnits', titleFontUnits);
+ set(colorbarYLabel, 'Units', yLabelUnits);
+ set(colorbarYLabel, 'FontUnits', yLabelFontUnits);
-if ~isHG2
- set(colorbarXLabel,'Units',xLabelUnits);
- set(colorbarXLabel,'FontUnits',xLabelFontUnits);
-end
-
-
-%-------------------------------------------------------------------------%
+ if ~isHG2
+ set(colorbarXLabel, 'Units', xLabelUnits);
+ set(colorbarXLabel, 'FontUnits', xLabelFontUnits);
+ end
-%-some colorbar settings-%
+ %---------------------------------------------------------------------%
-lineWidth = colorbarData.LineWidth*obj.PlotlyDefaults.AxisLineIncreaseFactor;
-tickLength = min(obj.PlotlyDefaults.MaxTickLength,...
- max(colorbarData.TickLength(1)*colorbarData.Position(3)*obj.layout.width,...
- colorbarData.TickLength(1)*colorbarData.Position(4)*obj.layout.height));
+ %-some colorbar settings-%
-colorbar.thicknessmode = 'fraction';
-colorbar.thickness = colorbarData.Position(3);
-colorbar.tickwidth = lineWidth;
-colorbar.ticklen = tickLength;
+ lineWidth = colorbarData.LineWidth ...
+ * obj.PlotlyDefaults.AxisLineIncreaseFactor;
+ tickLength = min(obj.PlotlyDefaults.MaxTickLength,...
+ max(colorbarData.TickLength(1) * colorbarData.Position(3) ...
+ * obj.layout.width, colorbarData.TickLength(1) ...
+ * colorbarData.Position(4) * obj.layout.height));
-colorbar.lenmode = 'fraction';
-colorbar.len = colorbarData.Position(4)*1.025;
-colorbar.outlinewidth = lineWidth;
+ colorbar.thicknessmode = 'fraction';
+ colorbar.thickness = colorbarData.Position(3);
+ colorbar.tickwidth = lineWidth;
+ colorbar.ticklen = tickLength;
-%-------------------------------------------------------------------------%
+ colorbar.lenmode = 'fraction';
+ colorbar.len = colorbarData.Position(4)*1.025;
+ colorbar.outlinewidth = lineWidth;
-% orientation vertical check
-orientVert = colorbar.len > colorbar.thickness;
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ % orientation vertical check
+ orientVert = colorbar.len > colorbar.thickness;
-%-coloration-%
+ %---------------------------------------------------------------------%
-if isHG2
- col = 255*colorbarData.Color;
-else
- if orientVert
- col = 255*colorbarData.YColor;
+ %-coloration-%
+ if isHG2
+ col = 255*colorbarData.Color;
else
- col = 255*colorbarData.XColor;
+ if orientVert
+ col = 255*colorbarData.YColor;
+ else
+ col = 255*colorbarData.XColor;
+ end
end
-end
-
-colorbarColor = sprintf('rgb(%f,%f,%f)', col);
-
-colorbar.outlinecolor = colorbarColor;
-colorbar.tickcolor = colorbarColor;
-colorbar.tickfont.color = colorbarColor;
-
-%-------------------------------------------------------------------------%
-
-%-axis tickfont-%
-colorbar.tickfont.size = colorbarData.FontSize;
-colorbar.tickfont.family = matlab2plotlyfont(colorbarData.FontName);
-
-%-------------------------------------------------------------------------%
-
-%-colorbar pad-%
-colorbar.xpad = obj.PlotlyDefaults.MarginPad;
-colorbar.ypad = obj.PlotlyDefaults.MarginPad;
-
-%-------------------------------------------------------------------------%
-%-set ticklabels-%
-nticks = length(colorbarData.Ticks);
+ colorbarColor = sprintf('rgb(%f,%f,%f)', col);
-if isHG2
- if isempty(colorbarData.Ticks)
- %-hide tick labels-%
- colorbar.ticks = '';
- colorbar.showticklabels = false;
+ colorbar.outlinecolor = colorbarColor;
+ colorbar.tickcolor = colorbarColor;
+ colorbar.tickfont.color = colorbarColor;
- else
+ %---------------------------------------------------------------------%
- %-tick direction-%
- switch colorbarData.TickDirection
- case 'in'
- colorbar.ticks = 'inside';
- case 'out'
- colorbar.ticks = 'outside';
- end
+ %-axis tickfont-%
+ colorbar.tickfont.size = colorbarData.FontSize;
+ colorbar.tickfont.family = matlab2plotlyfont(colorbarData.FontName);
- if strcmp(colorbarData.TickLabelsMode,'auto')
- colorbar.autotick = true;
- colorbar.nticks = length(colorbarData.Ticks) + 1; %nticks = max ticks (so + 1)
+ %---------------------------------------------------------------------%
- else
+ %-colorbar pad-%
+ colorbar.xpad = obj.PlotlyDefaults.MarginPad;
+ colorbar.ypad = obj.PlotlyDefaults.MarginPad;
- %-show tick labels-%
- if isempty(colorbarData.TickLabels)
- colorbar.showticklabels = false;
+ %---------------------------------------------------------------------%
- else
- colorbar.autotick = false;
- colorbar.tickvals = colorbarData.Ticks;
- colorbar.ticktext = colorbarData.TickLabels;
- end
- end
- end
+ %-set ticklabels-%
+ nticks = length(colorbarData.Ticks);
-else
- if orientVert
- if isempty(colorbarData.YTick)
- %-show tick labels-%
+ if isHG2
+ if isempty(colorbarData.Ticks)
+ %-hide tick labels-%
colorbar.ticks = '';
colorbar.showticklabels = false;
else
%-tick direction-%
- switch colorbarData.TickDir
+ switch colorbarData.TickDirection
case 'in'
colorbar.ticks = 'inside';
case 'out'
colorbar.ticks = 'outside';
end
-
- if strcmp(colorbarData.YTickLabelMode,'auto')
- %-autotick-%
+
+ if strcmp(colorbarData.TickLabelsMode,'auto')
colorbar.autotick = true;
- %-numticks-%
- colorbar.nticks = length(colorbarData.YTick) + 1; %nticks = max ticks (so + 1)
+ % nticks = max ticks (so + 1)
+ colorbar.nticks = length(colorbarData.Ticks) + 1;
else
%-show tick labels-%
- if isempty(colorbarData.YTickLabel)
+ if isempty(colorbarData.TickLabels)
colorbar.showticklabels = false;
else
- %-autotick-%
colorbar.autotick = false;
- %-tick0-%
- colorbar.tick0 = str2double(colorbarData.YTickLabel(1,:));
- %-dtick-%
- colorbar.dtick = str2double(colorbarData.YTickLabel(2,:)) - str2double(colorbarData.YTickLabel(1,:));
+ colorbar.tickvals = colorbarData.Ticks;
+ colorbar.ticktext = colorbarData.TickLabels;
end
end
end
else
- if isempty(colorbarData.XTick)
- %-show tick labels-%
- colorbar.ticks = '';
- colorbar.showticklabels = false;
- else
- %-tick direction-%
- switch colorbarData.TickDir
- case 'in'
- colorbar.ticks = 'inside';
- case 'out'
- colorbar.ticks = 'outside';
- end
-
- if strcmp(colorbarData.XTickLabelMode,'auto')
- %-autotick-%
- colorbar.autotick = true;
- %-numticks-%
- colorbar.nticks = length(colorbarData.XTick) + 1;
- else
+ if orientVert
+ if isempty(colorbarData.YTick)
%-show tick labels-%
- if isempty(colorbarData.XTickLabel)
- colorbar.showticklabels = false;
+ colorbar.ticks = '';
+ colorbar.showticklabels = false;
+ else
+ %-tick direction-%
+ switch colorbarData.TickDir
+ case 'in'
+ colorbar.ticks = 'inside';
+ case 'out'
+ colorbar.ticks = 'outside';
+ end
+ if strcmp(colorbarData.YTickLabelMode, 'auto')
+ %-autotick-%
+ colorbar.autotick = true;
+ %-numticks-%
+ % nticks = max ticks (so + 1)
+ colorbar.nticks = length(colorbarData.YTick) + 1;
else
+ %-show tick labels-%
+ if isempty(colorbarData.YTickLabel)
+ colorbar.showticklabels = false;
+ else
+ %-autotick-%
+ colorbar.autotick = false;
+ %-tick0-%
+ colorbar.tick0 = ...
+ str2double(colorbarData.YTickLabel(1,:));
+ %-dtick-%
+ colorbar.dtick = ...
+ str2double(colorbarData.YTickLabel(2,:)) ...
+ - str2double(colorbarData.YTickLabel(1,:));
+ end
+ end
+ end
+ else
+ if isempty(colorbarData.XTick)
+ %-show tick labels-%
+ colorbar.ticks = '';
+ colorbar.showticklabels = false;
+ else
+ %-tick direction-%
+ switch colorbarData.TickDir
+ case 'in'
+ colorbar.ticks = 'inside';
+ case 'out'
+ colorbar.ticks = 'outside';
+ end
+ if strcmp(colorbarData.XTickLabelMode,'auto')
%-autotick-%
- colorbar.autotick = false;
- %-tick0-%
- colorbar.tick0 = str2double(colorbarData.XTickLabel(1,:));
- %-dtick-%
- colorbar.dtick = str2double(colorbarData.XTickLabel(2,:)) - str2double(colorbarData.XTickLabel(1,:));
+ colorbar.autotick = true;
+ %-numticks-%
+ colorbar.nticks = length(colorbarData.XTick) + 1;
+ else
+ %-show tick labels-%
+ if isempty(colorbarData.XTickLabel)
+ colorbar.showticklabels = false;
+ else
+ %-autotick-%
+ colorbar.autotick = false;
+ %-tick0-%
+ colorbar.tick0 = ...
+ str2double(colorbarData.XTickLabel(1,:));
+ %-dtick-%
+ colorbar.dtick = ...
+ str2double(colorbarData.XTickLabel(2,:)) ...
+ - str2double(colorbarData.XTickLabel(1,:));
+ end
end
end
end
end
-end
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-colorbar bg-color-%
-if ~isHG2
-
- if ~ischar(colorbarData.Color)
- col = 255*colorbarData.Color;
- else
- col = 255*figureData.Color;
+ %-colorbar bg-color-%
+ if ~isHG2
+ if ~ischar(colorbarData.Color)
+ col = 255*colorbarData.Color;
+ else
+ col = 255*figureData.Color;
+ end
+
+ obj.layout.plot_bgcolor = sprintf('rgb(%f,%f,%f)', col);
end
-
- obj.layout.plot_bgcolor = sprintf('rgb(%f,%f,%f)', col);
-end
-
-%-------------------------------------------------------------------------%
-%-ASSOCIATED DATA-%
-if isfield(colorbarData.UserData,'dataref')
- colorbarDataIndex = colorbarData.UserData.dataref;
-else
- colorbarDataIndex = findColorbarData(obj,colorbarIndex);
-end
+ %---------------------------------------------------------------------%
-if (nticks ~= 0)
- colorIndex = linspace(0, 1, nticks);
- colorData = linspace(0, 1, nticks-1);
- m = 1;
-
- for n = 1:nticks-1
- col = 1-colorData(n);
- colorscale{m} = {colorIndex(n), sprintf('rgb(%f,%f,%f)', 255*[col, col, col])};
- colorscale{m+1} = {colorIndex(n+1), sprintf('rgb(%f,%f,%f)', 255*[col, col, col])};
- m = 2*n+1;
+ %-ASSOCIATED DATA-%
+ if isfield(colorbarData.UserData,'dataref')
+ colorbarDataIndex = colorbarData.UserData.dataref;
+ else
+ colorbarDataIndex = findColorbarData(obj,colorbarIndex);
end
- obj.data{colorbarDataIndex}.marker.color = colorbarData.Ticks;
-else
- colorscale = {{0, 'rgb(255,255,255)'}, {1, 'rgb(0,0,0)'}}
-end
-obj.data{colorbarDataIndex}.marker.colorscale = colorscale;
-obj.data{colorbarDataIndex}.marker.colorbar = colorbar;
-obj.data{colorbarDataIndex}.showscale = true;
+ if (nticks ~= 0)
+ colorIndex = linspace(0, 1, nticks);
+ colorData = linspace(0, 1, nticks-1);
+ m = 1;
+
+ for n = 1:nticks-1
+ col = 1-colorData(n);
+ colorscale{m} = {colorIndex(n), ...
+ sprintf('rgb(%f,%f,%f)', ...
+ 255*[col, col, col])};
+ colorscale{m+1} = {colorIndex(n+1), ...
+ sprintf('rgb(%f,%f,%f)', ...
+ 255*[col, col, col])};
+ m = 2*n+1;
+ end
+ obj.data{colorbarDataIndex}.marker.color = colorbarData.Ticks;
+ else
+ colorscale = {{0, 'rgb(255,255,255)'}, {1, 'rgb(0,0,0)'}};
+ end
-%-------------------------------------------------------------------------%
+ obj.data{colorbarDataIndex}.marker.colorscale = colorscale;
+ obj.data{colorbarDataIndex}.marker.colorbar = colorbar;
+ obj.data{colorbarDataIndex}.showscale = true;
-%-REVERT UNITS-%
-set(obj.State.Colorbar(colorbarIndex).Handle,'Units',colorbarunits);
+ %---------------------------------------------------------------------%
+ %-REVERT UNITS-%
+ set(obj.State.Colorbar(colorbarIndex).Handle,'Units',colorbarunits);
end
diff --git a/plotly/plotlyfig_aux/core/updateTiledLayoutAnnotation.m b/plotly/plotlyfig_aux/core/updateTiledLayoutAnnotation.m
index 660b74e1..b5812b31 100644
--- a/plotly/plotlyfig_aux/core/updateTiledLayoutAnnotation.m
+++ b/plotly/plotlyfig_aux/core/updateTiledLayoutAnnotation.m
@@ -1,7 +1,4 @@
function obj = updateTiledLayoutAnnotation(obj, tiledLayoutData)
-
- %-------------------------------------------------------------------------%
-
%-INITIALIZATIONS-%
anIndex = obj.State.Figure.NumTexts + 1;
titleStruct = tiledLayoutData.Title;
@@ -11,7 +8,7 @@
obj.layout.annotations{anIndex}.yref = 'paper';
obj.layout.annotations{anIndex}.align = titleStruct.HorizontalAlignment;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-anchors-%
obj.layout.annotations{anIndex}.xanchor = titleStruct.HorizontalAlignment;
@@ -25,7 +22,7 @@
obj.layout.annotations{anIndex}.yanchor = 'bottom';
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-text-%
titleString = titleStruct.String;
@@ -39,13 +36,13 @@
obj.layout.annotations{anIndex}.text = titleTex;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-text location-%
obj.layout.annotations{anIndex}.x = 0.5;
obj.layout.annotations{anIndex}.y = 0.95;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-font properties-%
titleColor = sprintf('rgb(%f,%f,%f)', 255*titleStruct.Color);
@@ -63,7 +60,7 @@
otherwise
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-title angle-%
textAngle = titleStruct.Rotation;
@@ -74,11 +71,10 @@
obj.layout.annotations{anIndex}.textangle = textAngle;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-hide text (a workaround)-%
if strcmp(titleStruct.Visible,'off')
obj.layout.annotations{anIndex}.text = ' ';
end
-
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/UpdateGeoAxes.m b/plotly/plotlyfig_aux/handlegraphics/UpdateGeoAxes.m
index 99361333..7c647873 100644
--- a/plotly/plotlyfig_aux/handlegraphics/UpdateGeoAxes.m
+++ b/plotly/plotlyfig_aux/handlegraphics/UpdateGeoAxes.m
@@ -1,5 +1,4 @@
function UpdateGeoAxes(obj, geoIndex)
-
%-AXIS INDEX-%
axIndex = obj.getAxisIndex(obj.State.Plot(geoIndex).AssociatedAxis);
@@ -9,7 +8,7 @@ function UpdateGeoAxes(obj, geoIndex)
%-CHECK FOR MULTIPLE AXES-%
[xsource, ysource] = findSourceAxis(obj,axIndex);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set domain geo plot-%
xo = geoData.Position(1);
@@ -20,19 +19,18 @@ function UpdateGeoAxes(obj, geoIndex)
geoaxes.domain.x = min([xo xo + w],1);
geoaxes.domain.y = min([yo yo + h],1);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-setting projection-%
if strcmpi(obj.PlotOptions.geoRenderType, 'geo')
geoaxes.projection.type = 'mercator';
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-setting basemap-%
if strcmpi(obj.PlotOptions.geoRenderType, 'geo')
geoaxes.framecolor = 'rgb(120,120,120)';
-
if strcmpi(geoData.Basemap, 'streets-light')
geoaxes.oceancolor = 'rgba(215,215,220,1)';
geoaxes.landcolor = 'rgba(220,220,220,0.4)';
@@ -42,13 +40,12 @@ function UpdateGeoAxes(obj, geoIndex)
geoaxes.showcountries = true;
geoaxes.showlakes = true;
end
-
geoaxes.showocean = true;
geoaxes.showcoastlines = false;
geoaxes.showland = true;
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-setting latitude axis-%
if strcmpi(obj.PlotOptions.geoRenderType, 'geo')
@@ -65,7 +62,7 @@ function UpdateGeoAxes(obj, geoIndex)
end
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-setting longitude axis-%
if strcmpi(obj.PlotOptions.geoRenderType, 'geo')
@@ -82,25 +79,24 @@ function UpdateGeoAxes(obj, geoIndex)
end
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set map center-%
geoaxes.center.lat = geoData.MapCenter(1);
geoaxes.center.lon = geoData.MapCenter(2);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set better resolution-%
if strcmpi(obj.PlotOptions.geoRenderType, 'geo')
geoaxes.resolution = '50';
end
- %-----------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set mapbox style-%
if strcmpi(obj.PlotOptions.geoRenderType, 'mapbox')
geoaxes.zoom = geoData.ZoomLevel - 1.4;
-
if strcmpi(geoData.Basemap, 'streets-light')
geoaxes.style = 'carto-positron';
elseif strcmpi(geoData.Basemap, 'colorterrain')
@@ -108,7 +104,7 @@ function UpdateGeoAxes(obj, geoIndex)
end
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-TEXT STTINGS-%
isText = false;
@@ -132,13 +128,11 @@ function UpdateGeoAxes(obj, geoIndex)
else
pos{t} = child(t).HorizontalAlignment;
end
-
t = t + 1;
end
end
if isText
-
if strcmpi(obj.PlotOptions.geoRenderType, 'geo')
obj.data{geoIndex}.type = 'scattergeo';
elseif strcmpi(obj.PlotOptions.geoRenderType, 'mapbox')
@@ -162,7 +156,7 @@ function UpdateGeoAxes(obj, geoIndex)
end
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set geo axes to layout-%
if strcmpi(obj.PlotOptions.geoRenderType, 'geo')
@@ -170,6 +164,4 @@ function UpdateGeoAxes(obj, geoIndex)
elseif strcmpi(obj.PlotOptions.geoRenderType, 'mapbox')
obj.layout = setfield(obj.layout, sprintf('mapbox%d', xsource+1), geoaxes);
end
-
- %-------------------------------------------------------------------------%
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateAlternativeBoxplot.m b/plotly/plotlyfig_aux/handlegraphics/updateAlternativeBoxplot.m
index 152bce5d..4eac7259 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateAlternativeBoxplot.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateAlternativeBoxplot.m
@@ -1,8 +1,5 @@
function obj = updateAlternativeBoxplot(obj, dataIndex)
-
- %-------------------------------------------------------------------------%
-
- %-INITIALIZATIONS-%
+ %-INITIALIZATIONS-%
axIndex = obj.getAxisIndex(obj.State.Plot(dataIndex).AssociatedAxis);
plotStructure = obj.State.Plot(dataIndex).Handle;
@@ -11,28 +8,21 @@
nTraces = length(plotData);
traceIndex = dataIndex;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-update traces-%
for t = 1:nTraces
-
if t ~= 1
obj.PlotOptions.nPlots = obj.PlotOptions.nPlots + 1;
traceIndex = obj.PlotOptions.nPlots;
end
-
updateBoxplotLine(obj, axIndex, plotData(t), traceIndex);
end
-
- %-------------------------------------------------------------------------%
end
function updateBoxplotLine(obj, axIndex, plotData, traceIndex)
-
- %-------------------------------------------------------------------------%
-
- %-INITIALIZATIONS-%
+ %-INITIALIZATIONS-%
%-get axis info-%
[xSource, ySource] = findSourceAxis(obj, axIndex);
@@ -41,13 +31,21 @@ function updateBoxplotLine(obj, axIndex, plotData, traceIndex)
xData = plotData.XData;
yData = plotData.YData;
- if isduration(xData) || isdatetime(xData), xData = datenum(xData); end
- if isduration(yData) || isdatetime(yData), yData = datenum(yData); end
+ if isduration(xData) || isdatetime(xData)
+ xData = datenum(xData);
+ end
+ if isduration(yData) || isdatetime(yData)
+ yData = datenum(yData);
+ end
- if length(xData) < 2, xData = ones(1,2)*xData; end
- if length(yData) < 2, yData = ones(1,2)*yData; end
+ if length(xData) < 2
+ xData = ones(1,2)*xData;
+ end
+ if length(yData) < 2
+ yData = ones(1,2)*yData;
+ end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set trace-%
obj.data{traceIndex}.type = 'scatter';
@@ -57,13 +55,13 @@ function updateBoxplotLine(obj, axIndex, plotData, traceIndex)
obj.data{traceIndex}.xaxis = sprintf('x%d', xSource);
obj.data{traceIndex}.yaxis = sprintf('y%d', ySource);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set trace data-%
obj.data{traceIndex}.x = xData;
obj.data{traceIndex}.y = yData;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set marker properties-%
obj.data{traceIndex}.marker = extractLineMarker(plotData);
@@ -71,7 +69,7 @@ function updateBoxplotLine(obj, axIndex, plotData, traceIndex)
%-set line properties-%
obj.data{traceIndex}.line = extractLineLine(plotData);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-legend-%
leg = plotData.Annotation;
@@ -89,6 +87,4 @@ function updateBoxplotLine(obj, axIndex, plotData, traceIndex)
if isempty(obj.data{traceIndex}.name)
obj.data{traceIndex}.showlegend = false;
end
-
- %-------------------------------------------------------------------------%
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateAnimatedLine.m b/plotly/plotlyfig_aux/handlegraphics/updateAnimatedLine.m
index a504440d..de98a3b3 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateAnimatedLine.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateAnimatedLine.m
@@ -1,286 +1,284 @@
function updateAnimatedLine(obj,plotIndex)
+ axisData = obj.State.Plot(plotIndex).AssociatedAxis;
-axisData = obj.State.Plot(plotIndex).AssociatedAxis;
+ %-AXIS INDEX-%
+ axIndex = obj.getAxisIndex(axisData);
-%-AXIS INDEX-%
-axIndex = obj.getAxisIndex(axisData);
+ %-PLOT DATA STRUCTURE- %
+ plotData = obj.State.Plot(plotIndex).Handle;
-%-PLOT DATA STRUCTURE- %
-plotData = obj.State.Plot(plotIndex).Handle;
+ animObjs = obj.State.Plot(plotIndex).AssociatedAxis.Children;
-animObjs = obj.State.Plot(plotIndex).AssociatedAxis.Children;
-
-for i=1:numel(animObjs)
- if isequaln(animObjs(i),plotData)
- animObj = animObjs(i);
+ for i=1:numel(animObjs)
+ if isequaln(animObjs(i),plotData)
+ animObj = animObjs(i);
+ end
end
-end
-%-CHECK FOR MULTIPLE AXES-%
-[xsource, ysource] = findSourceAxis(obj,axIndex);
+ %-CHECK FOR MULTIPLE AXES-%
+ [xsource, ysource] = findSourceAxis(obj,axIndex);
-%-AXIS DATA-%
-xaxis = obj.layout.("xaxis" + xsource);
-yaxis = obj.layout.("yaxis" + ysource);
+ %-AXIS DATA-%
+ xaxis = obj.layout.("xaxis" + xsource);
+ yaxis = obj.layout.("yaxis" + ysource);
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-if polar plot or not-%
-treatas = obj.PlotOptions.TreatAs;
-ispolar = strcmpi(treatas, 'compass') || strcmpi(treatas, 'ezpolar');
+ %-if polar plot or not-%
+ treatas = obj.PlotOptions.TreatAs;
+ ispolar = strcmpi(treatas, 'compass') || strcmpi(treatas, 'ezpolar');
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-getting data-%
-try
- [x,y,z] = getpoints(animObj);
-catch
- x = plotData.XData;
- y = plotData.YData;
- z = plotData.ZData;
-end
+ %-getting data-%
+ try
+ [x,y,z] = getpoints(animObj);
+ catch
+ x = plotData.XData;
+ y = plotData.YData;
+ z = plotData.ZData;
+ end
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-scatter xaxis-%
-obj.data{plotIndex}.xaxis = ['x' num2str(xsource)];
+ %-scatter xaxis-%
+ obj.data{plotIndex}.xaxis = ['x' num2str(xsource)];
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-scatter yaxis-%
-obj.data{plotIndex}.yaxis = ['y' num2str(ysource)];
+ %-scatter yaxis-%
+ obj.data{plotIndex}.yaxis = ['y' num2str(ysource)];
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-scatter type-%
-obj.data{plotIndex}.type = 'scatter';
+ %-scatter type-%
+ obj.data{plotIndex}.type = 'scatter';
-if ispolar
- obj.data{plotIndex}.type = 'scatterpolar';
-end
+ if ispolar
+ obj.data{plotIndex}.type = 'scatterpolar';
+ end
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-scatter visible-%
-obj.data{plotIndex}.visible = strcmp(plotData.Visible,'on');
+ %-scatter visible-%
+ obj.data{plotIndex}.visible = strcmp(plotData.Visible,'on');
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-scatter x-%
+ %-scatter x-%
-if ispolar
- r = sqrt(x.^2 + y.^2);
- obj.data{plotIndex}.r = r;
-else
- obj.data{plotIndex}.x = [x(1) x(1)];
-end
-
-%-------------------------------------------------------------------------%
+ if ispolar
+ r = sqrt(x.^2 + y.^2);
+ obj.data{plotIndex}.r = r;
+ else
+ obj.data{plotIndex}.x = [x(1) x(1)];
+ end
-%-scatter y-%
-if ispolar
- theta = atan2(x,y);
- obj.data{plotIndex}.theta = -(rad2deg(theta) - 90);
-else
- obj.data{plotIndex}.y = [y(1) y(1)];
-end
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
-
-%-For 3D plots-%
-obj.PlotOptions.is3d = false; % by default
-
-numbset = unique(z);
-if numel(numbset)>1
- if any(z)
- %-scatter z-%
- obj.data{plotIndex}.z = [z(1) z(1)];
-
- %-overwrite type-%
- obj.data{plotIndex}.type = 'scatter3d';
-
- %-flag to manage 3d plots-%
- obj.PlotOptions.is3d = true;
+ %-scatter y-%
+ if ispolar
+ theta = atan2(x,y);
+ obj.data{plotIndex}.theta = -(rad2deg(theta) - 90);
+ else
+ obj.data{plotIndex}.y = [y(1) y(1)];
end
-end
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-scatter name-%
-obj.data{plotIndex}.name = plotData.DisplayName;
+ %-For 3D plots-%
+ obj.PlotOptions.is3d = false; % by default
+
+ numbset = unique(z);
+ if numel(numbset)>1
+ if any(z)
+ %-scatter z-%
+ obj.data{plotIndex}.z = [z(1) z(1)];
+
+ %-overwrite type-%
+ obj.data{plotIndex}.type = 'scatter3d';
+
+ %-flag to manage 3d plots-%
+ obj.PlotOptions.is3d = true;
+ end
+ end
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-scatter mode-%
-if ~strcmpi('none', plotData.Marker) ...
- && ~strcmpi('none', plotData.LineStyle)
- mode = 'lines+markers';
-elseif ~strcmpi('none', plotData.Marker)
- mode = 'markers';
-elseif ~strcmpi('none', plotData.LineStyle)
- mode = 'lines';
-else
- mode = 'none';
-end
+ %-scatter name-%
+ obj.data{plotIndex}.name = plotData.DisplayName;
-obj.data{plotIndex}.mode = mode;
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-scatter mode-%
+ if ~strcmpi('none', plotData.Marker) ...
+ && ~strcmpi('none', plotData.LineStyle)
+ mode = 'lines+markers';
+ elseif ~strcmpi('none', plotData.Marker)
+ mode = 'markers';
+ elseif ~strcmpi('none', plotData.LineStyle)
+ mode = 'lines';
+ else
+ mode = 'none';
+ end
-%-scatter line-%
-obj.data{plotIndex}.line = extractLineLine(plotData);
+ obj.data{plotIndex}.mode = mode;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-scatter marker-%
-obj.data{plotIndex}.marker = extractLineMarker(plotData);
+ %-scatter line-%
+ obj.data{plotIndex}.line = extractLineLine(plotData);
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-scatter showlegend-%
-leg = plotData.Annotation;
-legInfo = leg.LegendInformation;
+ %-scatter marker-%
+ obj.data{plotIndex}.marker = extractLineMarker(plotData);
-switch legInfo.IconDisplayStyle
- case 'on'
- showleg = true;
- case 'off'
- showleg = false;
-end
+ %---------------------------------------------------------------------%
+
+ %-scatter showlegend-%
+ leg = plotData.Annotation;
+ legInfo = leg.LegendInformation;
-obj.data{plotIndex}.showlegend = showleg;
+ switch legInfo.IconDisplayStyle
+ case 'on'
+ showleg = true;
+ case 'off'
+ showleg = false;
+ end
-%-------------------------------------------------------------------------%
+ obj.data{plotIndex}.showlegend = showleg;
-%-SCENE CONFIGUTATION-% for 3D animations, like comet3
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
-if obj.PlotOptions.is3d
+ %-SCENE CONFIGUTATION-% for 3D animations, like comet3
- %-aspect ratio-%
- asr = obj.PlotOptions.AspectRatio;
+ %---------------------------------------------------------------------%
+ if obj.PlotOptions.is3d
- if ~isempty(asr)
- if ischar(asr)
- scene.aspectmode = asr;
- elseif isvector(ar) && length(asr) == 3
- xar = asr(1);
- yar = asr(2);
- zar = asr(3);
+ %-aspect ratio-%
+ asr = obj.PlotOptions.AspectRatio;
+
+ if ~isempty(asr)
+ if ischar(asr)
+ scene.aspectmode = asr;
+ elseif isvector(ar) && length(asr) == 3
+ xar = asr(1);
+ yar = asr(2);
+ zar = asr(3);
+ end
+ else
+
+ %-define as default-%
+ xar = max(x(:));
+ yar = max(y(:));
+ xyar = max([xar, yar]);
+ zar = 0.75*xyar;
end
- else
- %-define as default-%
- xar = max(x(:));
- yar = max(y(:));
- xyar = max([xar, yar]);
- zar = 0.75*xyar;
- end
-
- scene.aspectratio.x = 1.1*xyar;
- scene.aspectratio.y = 1.0*xyar;
- scene.aspectratio.z = zar;
+ scene.aspectratio.x = 1.1*xyar;
+ scene.aspectratio.y = 1.0*xyar;
+ scene.aspectratio.z = zar;
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
- %-camera eye-%
- ey = obj.PlotOptions.CameraEye;
+ %-camera eye-%
+ ey = obj.PlotOptions.CameraEye;
- if ~isempty(ey)
- if isvector(ey) && length(ey) == 3
- scene.camera.eye.x = ey(1);
- scene.camera.eye.y = ey(2);
- scene.camera.eye.z = ey(3);
- end
- else
+ if ~isempty(ey)
+ if isvector(ey) && length(ey) == 3
+ scene.camera.eye.x = ey(1);
+ scene.camera.eye.y = ey(2);
+ scene.camera.eye.z = ey(3);
+ end
+ else
- %-define as default-%
- xey = - xyar; if xey>0, xfac = -0.0; else, xfac = 0.0; end
- yey = - xyar; if yey>0, yfac = -0.3; else, yfac = 0.3; end
- if zar>0, zfac = -0.1; else, zfac = 0.1; end
+ %-define as default-%
+ xey = - xyar; if xey>0, xfac = -0.0; else, xfac = 0.0; end
+ yey = - xyar; if yey>0, yfac = -0.3; else, yfac = 0.3; end
+ if zar>0, zfac = -0.1; else, zfac = 0.1; end
- scene.camera.eye.x = xey + xfac*xey;
- scene.camera.eye.y = yey + yfac*yey;
- scene.camera.eye.z = zar + zfac*zar;
- end
+ scene.camera.eye.x = xey + xfac*xey;
+ scene.camera.eye.y = yey + yfac*yey;
+ scene.camera.eye.z = zar + zfac*zar;
+ end
- %-------------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
- %-scene axis configuration-%
+ %-scene axis configuration-%
- scene.xaxis.range = axisData.XLim;
- scene.yaxis.range = axisData.YLim;
- scene.zaxis.range = axisData.ZLim;
+ scene.xaxis.range = axisData.XLim;
+ scene.yaxis.range = axisData.YLim;
+ scene.zaxis.range = axisData.ZLim;
- scene.xaxis.tickvals = axisData.XTick;
- scene.xaxis.ticktext = axisData.XTickLabel;
+ scene.xaxis.tickvals = axisData.XTick;
+ scene.xaxis.ticktext = axisData.XTickLabel;
- scene.yaxis.tickvals = axisData.YTick;
- scene.yaxis.ticktext = axisData.YTickLabel;
+ scene.yaxis.tickvals = axisData.YTick;
+ scene.yaxis.ticktext = axisData.YTickLabel;
- scene.zaxis.tickvals = axisData.ZTick;
- scene.zaxis.ticktext = axisData.ZTickLabel;
+ scene.zaxis.tickvals = axisData.ZTick;
+ scene.zaxis.ticktext = axisData.ZTickLabel;
- scene.xaxis.zeroline = false;
- scene.yaxis.zeroline = false;
- scene.zaxis.zeroline = false;
+ scene.xaxis.zeroline = false;
+ scene.yaxis.zeroline = false;
+ scene.zaxis.zeroline = false;
- scene.xaxis.showgrid = strcmpi(axisData.XGrid,'on');
- scene.yaxis.showgrid = strcmpi(axisData.YGrid,'on');
- scene.zaxis.showgrid = strcmpi(axisData.ZGrid,'on');
+ scene.xaxis.showgrid = strcmpi(axisData.XGrid,'on');
+ scene.yaxis.showgrid = strcmpi(axisData.YGrid,'on');
+ scene.zaxis.showgrid = strcmpi(axisData.ZGrid,'on');
- scene.xaxis.showline = true;
- scene.yaxis.showline = true;
- scene.zaxis.showline = true;
+ scene.xaxis.showline = true;
+ scene.yaxis.showline = true;
+ scene.zaxis.showline = true;
- scene.xaxis.tickcolor = 'rgba(0,0,0,1)';
- scene.yaxis.tickcolor = 'rgba(0,0,0,1)';
- scene.zaxis.tickcolor = 'rgba(0,0,0,1)';
+ scene.xaxis.tickcolor = 'rgba(0,0,0,1)';
+ scene.yaxis.tickcolor = 'rgba(0,0,0,1)';
+ scene.zaxis.tickcolor = 'rgba(0,0,0,1)';
- scene.xaxis.ticklabelposition = 'outside';
- scene.yaxis.ticklabelposition = 'outside';
- scene.zaxis.ticklabelposition = 'outside';
+ scene.xaxis.ticklabelposition = 'outside';
+ scene.yaxis.ticklabelposition = 'outside';
+ scene.zaxis.ticklabelposition = 'outside';
- scene.xaxis.title = axisData.XLabel.String;
- scene.yaxis.title = axisData.YLabel.String;
- scene.zaxis.title = axisData.ZLabel.String;
+ scene.xaxis.title = axisData.XLabel.String;
+ scene.yaxis.title = axisData.YLabel.String;
+ scene.zaxis.title = axisData.ZLabel.String;
- scene.xaxis.tickfont.size = axisData.FontSize;
- scene.yaxis.tickfont.size = axisData.FontSize;
- scene.zaxis.tickfont.size = axisData.FontSize;
+ scene.xaxis.tickfont.size = axisData.FontSize;
+ scene.yaxis.tickfont.size = axisData.FontSize;
+ scene.zaxis.tickfont.size = axisData.FontSize;
- scene.xaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
- scene.yaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
- scene.zaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
+ scene.xaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
+ scene.yaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
+ scene.zaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
- %-------------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
- %-SET SCENE TO LAYOUT-%
- obj.layout = setfield(obj.layout, sprintf('scene%d', xsource), scene);
-end
+ %-SET SCENE TO LAYOUT-%
+ obj.layout = setfield(obj.layout, sprintf('scene%d', xsource), scene);
+ end
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-Add a temporary tag-%
-obj.layout.isAnimation = true;
+ %-Add a temporary tag-%
+ obj.layout.isAnimation = true;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-Create Frames-%
-frameData = obj.data{plotIndex};
+ %-Create Frames-%
+ frameData = obj.data{plotIndex};
-for i = 1:length(x)
- sIdx = i - plotData.MaximumNumPoints;
- if sIdx < 0
- sIdx=0;
- end
- frameData.x=x(sIdx+1:i);
- frameData.y=y(sIdx+1:i);
- if obj.PlotOptions.is3d
- frameData.z=z(sIdx+1:i);
+ for i = 1:length(x)
+ sIdx = i - plotData.MaximumNumPoints;
+ if sIdx < 0
+ sIdx=0;
+ end
+ frameData.x=x(sIdx+1:i);
+ frameData.y=y(sIdx+1:i);
+ if obj.PlotOptions.is3d
+ frameData.z=z(sIdx+1:i);
+ end
+ obj.frames{i}.name = ['f',num2str(i)];
+ obj.frames{i}.data{plotIndex} = frameData;
end
- obj.frames{i}.name = ['f',num2str(i)];
- obj.frames{i}.data{plotIndex} = frameData;
-end
-
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateAreaseries.m b/plotly/plotlyfig_aux/handlegraphics/updateAreaseries.m
index 1e4415eb..360c28d5 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateAreaseries.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateAreaseries.m
@@ -1,27 +1,14 @@
function updateAreaseries(obj,areaIndex)
+ %-store original area handle-%
+ area_group = obj.State.Plot(areaIndex).Handle;
-%-------------------------------------------------------------------------%
+ %-get children-%
+ area_child = area_group .Children;
-%-store original area handle-%
-area_group = obj.State.Plot(areaIndex).Handle;
-
-%------------------------------------------------------------------------%
-
-%-get children-%
-area_child = area_group .Children;
-
-%------------------------------------------------------------------------%
-
-%-update patch -%
-obj.State.Plot(areaIndex).Handle = area_child(1);
-updatePatch(obj,areaIndex);
-
-%------------------------------------------------------------------------%
-
-%-revert handle-%
-obj.State.Plot(areaIndex).Handle = area_group;
+ %-update patch -%
+ obj.State.Plot(areaIndex).Handle = area_child(1);
+ updatePatch(obj,areaIndex);
+ %-revert handle-%
+ obj.State.Plot(areaIndex).Handle = area_group;
end
-
-
-
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateBar3.m b/plotly/plotlyfig_aux/handlegraphics/updateBar3.m
index bf5c5d6a..1f632969 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateBar3.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateBar3.m
@@ -1,260 +1,248 @@
function obj = updateBar3(obj, surfaceIndex)
+ %-AXIS INDEX-%
+ axIndex = obj.getAxisIndex(obj.State.Plot(surfaceIndex).AssociatedAxis);
-%-AXIS INDEX-%
-axIndex = obj.getAxisIndex(obj.State.Plot(surfaceIndex).AssociatedAxis);
+ %-CHECK FOR MULTIPLE AXES-%
+ [xsource, ysource] = findSourceAxis(obj,axIndex);
-%-CHECK FOR MULTIPLE AXES-%
-[xsource, ysource] = findSourceAxis(obj,axIndex);
+ %-SURFACE DATA STRUCTURE- %
+ bar_data = obj.State.Plot(surfaceIndex).Handle;
+ figure_data = obj.State.Figure.Handle;
-%-SURFACE DATA STRUCTURE- %
-bar_data = obj.State.Plot(surfaceIndex).Handle;
-figure_data = obj.State.Figure.Handle;
+ %-AXIS STRUCTURE-%
+ axis_data = ancestor(bar_data.Parent,'axes');
-%-AXIS STRUCTURE-%
-axis_data = ancestor(bar_data.Parent,'axes');
+ %-GET SCENE-%
+ scene = obj.layout.("scene" + xsource);
-%-GET SCENE-%
-scene = obj.layout.("scene" + xsource);
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-associate scene-%
+ obj.data{surfaceIndex}.scene = sprintf('scene%d', xsource);
+
+ %---------------------------------------------------------------------%
-%-associate scene-%
-obj.data{surfaceIndex}.scene = sprintf('scene%d', xsource);
-
-%-------------------------------------------------------------------------%
+ %-surface type-%
+ obj.data{surfaceIndex}.type = 'mesh3d';
-%-surface type-%
-obj.data{surfaceIndex}.type = 'mesh3d';
+ %---------------------------------------------------------------------%
+
+ %-FORMAT DATA-%
+ xdata = bar_data.XData;
+ ydata = bar_data.YData;
+ zdata = bar_data.ZData;
+ cdata = bar_data.CData;
+
+ %-parse xedges-%
+ xedges = xdata(2, 1:2:end);
+
+ %-parse yedges-%
+ yedges = ydata(2:6:end, 2);
+ yedges = [yedges', mean(diff(yedges(1:2)))];
+
+ %-parse values-%
+ values = [];
+ for n = 1:6:size(zdata, 1)
+ values = [values, diff(zdata(n:n+1, 2))];
+ end
-%-------------------------------------------------------------------------%
-
-%-FORMAT DATA-%
-xdata = bar_data.XData;
-ydata = bar_data.YData;
-zdata = bar_data.ZData;
-cdata = bar_data.CData;
+ %-parse offsets-%
+ offsets = zdata(1:6:end, 2)';
+
+ %---------------------------------------------------------------------%
-%-parse xedges-%
-xedges = xdata(2, 1:2:end);
+ %-get the values to use plotly's mesh3D-%
+ bargap = diff(yedges(1:2)) - diff(ydata(2:3));
+ [X, Y, Z, I, J, K] = get_plotly_mesh3d(xedges, yedges, values, bargap);
-%-parse yedges-%
-yedges = ydata(2:6:end, 2);
-yedges = [yedges', mean(diff(yedges(1:2)))];
+ %---------------------------------------------------------------------%
-%-parse values-%
-values = [];
-for n = 1:6:size(zdata, 1)
- values = [values, diff(zdata(n:n+1, 2))];
-end
+ %-reformat Z according to offsets-%
+ m = 1;
+ lz2 = 0.5*length(Z);
-%-parse offsets-%
-offsets = zdata(1:6:end, 2)';
-
-%-------------------------------------------------------------------------%
+ for n = 1:4:lz2
+ Z(n:n+3) = Z(n:n+3)+offsets(m);
+ Z(n+lz2:n+lz2+3) = Z(n+lz2:n+lz2+3)+offsets(m);
+ m = m + 1;
+ end
-%-get the values to use plotly's mesh3D-%
-bargap = diff(yedges(1:2)) - diff(ydata(2:3));
-[X, Y, Z, I, J, K] = get_plotly_mesh3d(xedges, yedges, values, bargap);
+ %---------------------------------------------------------------------%
-%---------------------------------------------------------------------%
+ %-set mesh3d data-%
+ obj.data{surfaceIndex}.x = X;
+ obj.data{surfaceIndex}.y = Y;
+ obj.data{surfaceIndex}.z = Z;
+ obj.data{surfaceIndex}.i = int16(I-1);
+ obj.data{surfaceIndex}.j = int16(J-1);
+ obj.data{surfaceIndex}.k = int16(K-1);
-%-reformat Z according to offsets-%
-m = 1;
-lz2 = 0.5*length(Z);
+ %---------------------------------------------------------------------%
-for n = 1:4:lz2
- Z(n:n+3) = Z(n:n+3)+offsets(m);
- Z(n+lz2:n+lz2+3) = Z(n+lz2:n+lz2+3)+offsets(m);
- m = m + 1;
-end
+ %-coloring-%
+ cmap = figure_data.Colormap;
-%-------------------------------------------------------------------------%
-
-%-set mesh3d data-%
-obj.data{surfaceIndex}.x = X;
-obj.data{surfaceIndex}.y = Y;
-obj.data{surfaceIndex}.z = Z;
-obj.data{surfaceIndex}.i = int16(I-1);
-obj.data{surfaceIndex}.j = int16(J-1);
-obj.data{surfaceIndex}.k = int16(K-1);
-
-%-------------------------------------------------------------------------%
-
-%-coloring-%
-cmap = figure_data.Colormap;
-
-if isnumeric(bar_data.FaceColor)
-
- %-paper_bgcolor-%
- col = 255*bar_data.FaceColor;
- col = sprintf('rgb(%f,%f,%f)', col);
-
-else
- switch bar_data.FaceColor
-
- case 'none'
- col = 'rgba(0,0,0,0)';
-
- case {'flat','interp'}
-
- switch bar_data.CDataMapping
-
- case 'scaled'
- capCD = max(min(cdata(1,1),axis_data.CLim(2)),axis_data.CLim(1));
- scalefactor = (capCD - axis_data.CLim(1))/diff(axis_data.CLim);
- col = 255*(cmap(1+ floor(scalefactor*(length(cmap)-1)),:));
- case 'direct'
- col = 255*(cmap(cdata(1,1),:));
-
- end
-
- col = sprintf('rgb(%f,%f,%f)', col);
-
- case 'auto'
- col = 'rgb(0,113.985,188.955)';
+ if isnumeric(bar_data.FaceColor)
+ %-paper_bgcolor-%
+ col = 255*bar_data.FaceColor;
+ col = sprintf('rgb(%f,%f,%f)', col);
+ else
+ switch bar_data.FaceColor
+ case 'none'
+ col = 'rgba(0,0,0,0)';
+ case {'flat','interp'}
+ switch bar_data.CDataMapping
+ case 'scaled'
+ capCD = max(min(cdata(1,1), axis_data.CLim(2)), ...
+ axis_data.CLim(1));
+ scalefactor = (capCD - axis_data.CLim(1)) ...
+ / diff(axis_data.CLim);
+ col = 255*(cmap(1+ floor(scalefactor ...
+ * (length(cmap)-1)),:));
+ case 'direct'
+ col = 255*(cmap(cdata(1,1),:));
+ end
+ col = sprintf('rgb(%f,%f,%f)', col);
+ case 'auto'
+ col = 'rgb(0,113.985,188.955)';
+ end
end
-end
-obj.data{surfaceIndex}.color = col;
+ obj.data{surfaceIndex}.color = col;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-some settings-%
-obj.data{surfaceIndex}.contour.show = true;
-obj.data{surfaceIndex}.contour.width = 6;
-obj.data{surfaceIndex}.contour.color='rgb(0,0,0)';
-obj.data{surfaceIndex}.flatshading = false;
+ %-some settings-%
+ obj.data{surfaceIndex}.contour.show = true;
+ obj.data{surfaceIndex}.contour.width = 6;
+ obj.data{surfaceIndex}.contour.color='rgb(0,0,0)';
+ obj.data{surfaceIndex}.flatshading = false;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-lighting settings-%
-obj.data{surfaceIndex}.lighting.diffuse = 0.8;
-obj.data{surfaceIndex}.lighting.ambient = 0.65;
-obj.data{surfaceIndex}.lighting.specular = 1.42;
-obj.data{surfaceIndex}.lighting.roughness = 0.52;
-obj.data{surfaceIndex}.lighting.fresnel = 0.2;
-obj.data{surfaceIndex}.lighting.vertexnormalsepsilon = 1e-12;
-obj.data{surfaceIndex}.lighting.facenormalsepsilon = 1e-6;
+ %-lighting settings-%
+ obj.data{surfaceIndex}.lighting.diffuse = 0.8;
+ obj.data{surfaceIndex}.lighting.ambient = 0.65;
+ obj.data{surfaceIndex}.lighting.specular = 1.42;
+ obj.data{surfaceIndex}.lighting.roughness = 0.52;
+ obj.data{surfaceIndex}.lighting.fresnel = 0.2;
+ obj.data{surfaceIndex}.lighting.vertexnormalsepsilon = 1e-12;
+ obj.data{surfaceIndex}.lighting.facenormalsepsilon = 1e-6;
-obj.data{surfaceIndex}.lightposition.x = 0;
-obj.data{surfaceIndex}.lightposition.y = 0;
-obj.data{surfaceIndex}.lightposition.z = 0;
+ obj.data{surfaceIndex}.lightposition.x = 0;
+ obj.data{surfaceIndex}.lightposition.y = 0;
+ obj.data{surfaceIndex}.lightposition.z = 0;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-surface name-%
-obj.data{surfaceIndex}.name = bar_data.DisplayName;
+ %-surface name-%
+ obj.data{surfaceIndex}.name = bar_data.DisplayName;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-surface visible-%
-obj.data{surfaceIndex}.visible = strcmp(bar_data.Visible,'on');
+ %-surface visible-%
+ obj.data{surfaceIndex}.visible = strcmp(bar_data.Visible,'on');
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-leg = bar_data.Annotation;
-legInfo = leg.LegendInformation;
+ leg = bar_data.Annotation;
+ legInfo = leg.LegendInformation;
-switch legInfo.IconDisplayStyle
- case 'on'
- showleg = true;
- case 'off'
- showleg = false;
-end
+ switch legInfo.IconDisplayStyle
+ case 'on'
+ showleg = true;
+ case 'off'
+ showleg = false;
+ end
-obj.data{surfaceIndex}.showlegend = showleg;
+ obj.data{surfaceIndex}.showlegend = showleg;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-SETTING SCENE-%
+ %-SETTING SCENE-%
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-aspect ratio-%
-ar = obj.PlotOptions.AspectRatio;
+ %-aspect ratio-%
+ ar = obj.PlotOptions.AspectRatio;
-if ~isempty(ar)
- if ischar(ar)
- scene.aspectmode = ar;
- elseif isvector(ar) && length(ar) == 3
- xar = ar(1);
- yar = ar(2);
- zar = ar(3);
+ if ~isempty(ar)
+ if ischar(ar)
+ scene.aspectmode = ar;
+ elseif isvector(ar) && length(ar) == 3
+ xar = ar(1);
+ yar = ar(2);
+ zar = ar(3);
+ end
+ else
+ %-define as default-%
+ xar = max(xedges(:));
+ yar = max(yedges(:));
+ zar = 0.7*max([xar, yar]);
end
-else
-
- %-define as default-%
- xar = max(xedges(:));
- yar = max(yedges(:));
- zar = 0.7*max([xar, yar]);
-end
-scene.aspectratio.x = xar;
-scene.aspectratio.y = yar;
-scene.aspectratio.z = zar;
+ scene.aspectratio.x = xar;
+ scene.aspectratio.y = yar;
+ scene.aspectratio.z = zar;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-camera eye-%
-ey = obj.PlotOptions.CameraEye;
+ %-camera eye-%
+ ey = obj.PlotOptions.CameraEye;
-if ~isempty(ey)
- if isvector(ey) && length(ey) == 3
- scene.camera.eye.x = ey(1);
- scene.camera.eye.y = ey(2);
- scene.camera.eye.z = ey(3);
+ if ~isempty(ey)
+ if isvector(ey) && length(ey) == 3
+ scene.camera.eye.x = ey(1);
+ scene.camera.eye.y = ey(2);
+ scene.camera.eye.z = ey(3);
+ end
+ else
+ %-define as default-%
+ scene.camera.eye.x = xar + 7;
+ scene.camera.eye.y = yar - 2;
+ scene.camera.eye.z = zar + 0.5;
end
-else
- %-define as default-%
- scene.camera.eye.x = xar + 7;
- scene.camera.eye.y = yar - 2;
- scene.camera.eye.z = zar + 0.5;
-end
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-axis configuration-%
+ scene.xaxis.range = axis_data.XLim(end:-1:1);
+ scene.yaxis.range = axis_data.YLim;
+ scene.zaxis.range = axis_data.ZLim;
-%-axis configuration-%
-scene.xaxis.range = axis_data.XLim(end:-1:1);
-scene.yaxis.range = axis_data.YLim;
-scene.zaxis.range = axis_data.ZLim;
+ scene.xaxis.tickvals = axis_data.XTick;
+ scene.xaxis.ticktext = axis_data.XTickLabel;
-scene.xaxis.tickvals = axis_data.XTick;
-scene.xaxis.ticktext = axis_data.XTickLabel;
+ scene.yaxis.tickvals = axis_data.YTick;
+ scene.yaxis.ticktext = axis_data.YTickLabel;
-scene.yaxis.tickvals = axis_data.YTick;
-scene.yaxis.ticktext = axis_data.YTickLabel;
+ scene.zaxis.tickvals = axis_data.ZTick;
+ scene.zaxis.ticktext = axis_data.ZTickLabel;
-scene.zaxis.tickvals = axis_data.ZTick;
-scene.zaxis.ticktext = axis_data.ZTickLabel;
+ scene.xaxis.zeroline = false;
+ scene.yaxis.zeroline = false;
+ scene.zaxis.zeroline = false;
-scene.xaxis.zeroline = false;
-scene.yaxis.zeroline = false;
-scene.zaxis.zeroline = false;
+ scene.xaxis.showline = true;
+ scene.yaxis.showline = true;
+ scene.zaxis.showline = true;
-scene.xaxis.showline = true;
-scene.yaxis.showline = true;
-scene.zaxis.showline = true;
+ scene.xaxis.tickcolor = 'rgba(0,0,0,1)';
+ scene.yaxis.tickcolor = 'rgba(0,0,0,1)';
+ scene.zaxis.tickcolor = 'rgba(0,0,0,1)';
-scene.xaxis.tickcolor = 'rgba(0,0,0,1)';
-scene.yaxis.tickcolor = 'rgba(0,0,0,1)';
-scene.zaxis.tickcolor = 'rgba(0,0,0,1)';
+ scene.xaxis.ticklabelposition = 'outside';
+ scene.yaxis.ticklabelposition = 'outside';
+ scene.zaxis.ticklabelposition = 'outside';
-scene.xaxis.ticklabelposition = 'outside';
-scene.yaxis.ticklabelposition = 'outside';
-scene.zaxis.ticklabelposition = 'outside';
+ scene.xaxis.title = axis_data.XLabel.String;
+ scene.yaxis.title = axis_data.YLabel.String;
+ scene.zaxis.title = axis_data.ZLabel.String;
-scene.xaxis.title = axis_data.XLabel.String;
-scene.yaxis.title = axis_data.YLabel.String;
-scene.zaxis.title = axis_data.ZLabel.String;
-
-%-------------------------------------------------------------------------%
-
-%-SET SCENE TO LAYOUT-%
-obj.layout = setfield(obj.layout, sprintf('scene%d', xsource), scene);
-
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
+ %-SET SCENE TO LAYOUT-%
+ obj.layout = setfield(obj.layout, sprintf('scene%d', xsource), scene);
end
function bar_ = bar_data(position3d, size_)
@@ -278,24 +266,24 @@
]; % the vertices of the unit cube
for n =1:size(bar_, 1)
- bar_(n,:) = bar_(n,:) .* size_; % scale the cube to get the vertices of a parallelipipedic bar_
+ % scale the cube to get the vertices of a parallelipipedic bar_
+ bar_(n,:) = bar_(n,:) .* size_;
end
-
- bar_ = bar_ + position3d; %translate each bar_ on the directio OP, with P=position3d
+ % translate each bar_ on the directio OP, with P=position3d
+ bar_ = bar_ + position3d;
end
function [vertices, I, J, K] = triangulate_bar_faces(positions, sizes)
- % positions - array of shape (N, 3) that contains all positions in the plane z=0, where a histogram bar is placed
- % sizes - array of shape (N,3); each row represents the sizes to scale a unit cube to get a bar
- % returns the array of unique vertices, and the lists i, j, k to be used in instantiating the go.Mesh3d class
+ % positions - array of shape (N, 3) that contains all positions in the
+ % plane z=0, where a histogram bar is placed.
+ % sizes - array of shape (N,3); each row represents the sizes to scale
+ % a unit cube to get a bar.
+ % returns the array of unique vertices, and the lists i, j, k to be
+ % used in instantiating the go.Mesh3d class.
if nargin < 2
sizes = ones(size(positions,1), 3); %[(1,1,1)]*len(positions)
- else
- sizes;
- % if isinstance(sizes, (list, np.ndarray)) and len(sizes) != len(positions):
- % raise ValueError('Your positions and sizes lists/arrays do not have the same length')
end
c = 1;
@@ -330,7 +318,8 @@
end
function [X, Y, Z, I, J, K] = get_plotly_mesh3d(xedges, yedges, values, bargap)
- % x, y- array-like of shape (n,), defining the x, and y-ccordinates of data set for which we plot a 3d hist
+ % x, y - array-like of shape (n,), defining the x, and y-ccordinates of
+ % data set for which we plot a 3d hist.
xsize = xedges(2)-xedges(1)-bargap;
ysize = yedges(2)-yedges(1)-bargap;
@@ -355,5 +344,4 @@
X = vertices(:,1);
Y = vertices(:,2);
Z = vertices(:,3);
-
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateBar3h.m b/plotly/plotlyfig_aux/handlegraphics/updateBar3h.m
index d8185995..d11c47db 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateBar3h.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateBar3h.m
@@ -1,266 +1,261 @@
function obj = updateBar3h(obj, surfaceIndex)
+ %-AXIS INDEX-%
+ axIndex = obj.getAxisIndex(obj.State.Plot(surfaceIndex).AssociatedAxis);
-%-AXIS INDEX-%
-axIndex = obj.getAxisIndex(obj.State.Plot(surfaceIndex).AssociatedAxis);
+ %-CHECK FOR MULTIPLE AXES-%
+ [xsource, ysource] = findSourceAxis(obj,axIndex);
-%-CHECK FOR MULTIPLE AXES-%
-[xsource, ysource] = findSourceAxis(obj,axIndex);
+ %-SURFACE DATA STRUCTURE- %
+ bar_data = obj.State.Plot(surfaceIndex).Handle;
+ figure_data = obj.State.Figure.Handle;
-%-SURFACE DATA STRUCTURE- %
-bar_data = obj.State.Plot(surfaceIndex).Handle;
-figure_data = obj.State.Figure.Handle;
+ %-AXIS STRUCTURE-%
+ axis_data = ancestor(bar_data.Parent,'axes');
-%-AXIS STRUCTURE-%
-axis_data = ancestor(bar_data.Parent,'axes');
+ %-GET SCENE-%
+ scene = obj.layout.("scene" + xsource);
-%-GET SCENE-%
-scene = obj.layout.("scene" + xsource);
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-associate scene-%
+ obj.data{surfaceIndex}.scene = sprintf('scene%d', xsource);
+
+ %---------------------------------------------------------------------%
-%-associate scene-%
-obj.data{surfaceIndex}.scene = sprintf('scene%d', xsource);
-
-%-------------------------------------------------------------------------%
+ %-surface type-%
+ obj.data{surfaceIndex}.type = 'mesh3d';
-%-surface type-%
-obj.data{surfaceIndex}.type = 'mesh3d';
+ %---------------------------------------------------------------------%
+
+ %-FORMAT DATA-%
+ xdata = bar_data.XData;
+ ydata = bar_data.ZData;
+ zdata = bar_data.YData;
+ cdata = bar_data.CData;
+
+ %-parse xedges-%
+ xedges = xdata(2, 1:2:end);
+
+ %-parse yedges-%
+ yedges = ydata(2:6:end, 2);
+ yedges = [yedges', mean(diff(yedges(1:2)))];
+
+ %-parse values-%
+ values = [];
+ for n = 1:6:size(zdata, 1)
+ values = [values, diff(zdata(n:n+1, 2))];
+ end
-%-------------------------------------------------------------------------%
-
-%-FORMAT DATA-%
-xdata = bar_data.XData;
-ydata = bar_data.ZData;
-zdata = bar_data.YData;
-cdata = bar_data.CData;
+ %-parse offsets-%
+ offsets = zdata(1:6:end, 2)';
+
+ %---------------------------------------------------------------------%
-%-parse xedges-%
-xedges = xdata(2, 1:2:end);
+ %-get the values to use plotly's mesh3D-%
+ bargap = diff(yedges(1:2)) - diff(ydata(2:3));
+ [X, Y, Z, I, J, K] = get_plotly_mesh3d(xedges, yedges, values, bargap);
-%-parse yedges-%
-yedges = ydata(2:6:end, 2);
-yedges = [yedges', mean(diff(yedges(1:2)))];
+ %-----------------------------------------------------------------%
-%-parse values-%
-values = [];
-for n = 1:6:size(zdata, 1)
- values = [values, diff(zdata(n:n+1, 2))];
-end
+ %-reformat Z according to offsets-%
+ m = 1;
+ lz2 = 0.5*length(Z);
-%-parse offsets-%
-offsets = zdata(1:6:end, 2)';
-
-%-------------------------------------------------------------------------%
+ for n = 1:4:lz2
+ Z(n:n+3) = Z(n:n+3)+offsets(m);
+ Z(n+lz2:n+lz2+3) = Z(n+lz2:n+lz2+3)+offsets(m);
+ m = m + 1;
+ end
-%-get the values to use plotly's mesh3D-%
-bargap = diff(yedges(1:2)) - diff(ydata(2:3));
-[X, Y, Z, I, J, K] = get_plotly_mesh3d(xedges, yedges, values, bargap);
+ %---------------------------------------------------------------------%
-%---------------------------------------------------------------------%
+ %-set mesh3d data-%
+ obj.data{surfaceIndex}.x = X;
+ obj.data{surfaceIndex}.y = Z;
+ obj.data{surfaceIndex}.z = Y;
+ obj.data{surfaceIndex}.i = int16(I-1);
+ obj.data{surfaceIndex}.j = int16(J-1);
+ obj.data{surfaceIndex}.k = int16(K-1);
-%-reformat Z according to offsets-%
-m = 1;
-lz2 = 0.5*length(Z);
+ %---------------------------------------------------------------------%
-for n = 1:4:lz2
- Z(n:n+3) = Z(n:n+3)+offsets(m);
- Z(n+lz2:n+lz2+3) = Z(n+lz2:n+lz2+3)+offsets(m);
- m = m + 1;
-end
+ %-coloring-%
+ cmap = figure_data.Colormap;
-%-------------------------------------------------------------------------%
-
-%-set mesh3d data-%
-obj.data{surfaceIndex}.x = X;
-obj.data{surfaceIndex}.y = Z;
-obj.data{surfaceIndex}.z = Y;
-obj.data{surfaceIndex}.i = int16(I-1);
-obj.data{surfaceIndex}.j = int16(J-1);
-obj.data{surfaceIndex}.k = int16(K-1);
-
-%-------------------------------------------------------------------------%
-
-%-coloring-%
-cmap = figure_data.Colormap;
-
-if isnumeric(bar_data.FaceColor)
-
- %-paper_bgcolor-%
- col = 255*bar_data.FaceColor;
- col = sprintf('rgb(%f,%f,%f)', col);
-
-else
- switch bar_data.FaceColor
+ if isnumeric(bar_data.FaceColor)
- case 'none'
- col = 'rgba(0,0,0,0)';
-
- case {'flat','interp'}
-
- switch bar_data.CDataMapping
-
- case 'scaled'
- capCD = max(min(cdata(1,1),axis_data.CLim(2)),axis_data.CLim(1));
- scalefactor = (capCD - axis_data.CLim(1))/diff(axis_data.CLim);
- col = 255*(cmap(1+ floor(scalefactor*(length(cmap)-1)),:));
- case 'direct'
- col = 255*(cmap(cdata(1,1),:));
-
- end
-
- col = sprintf('rgb(%f,%f,%f)', col);
-
- case 'auto'
- col = 'rgb(0,113.985,188.955)';
+ %-paper_bgcolor-%
+ col = 255*bar_data.FaceColor;
+ col = sprintf('rgb(%f,%f,%f)', col);
+
+ else
+ switch bar_data.FaceColor
+ case 'none'
+ col = 'rgba(0,0,0,0)';
+ case {'flat','interp'}
+ switch bar_data.CDataMapping
+ case 'scaled'
+ capCD = max(min(cdata(1,1), axis_data.CLim(2)), ...
+ axis_data.CLim(1));
+ scalefactor = (capCD - axis_data.CLim(1)) ...
+ / diff(axis_data.CLim);
+ col = 255*(cmap(1+ floor(scalefactor ...
+ *(length(cmap)-1)),:));
+ case 'direct'
+ col = 255*(cmap(cdata(1,1),:));
+ end
+ col = sprintf('rgb(%f,%f,%f)', col);
+ case 'auto'
+ col = 'rgb(0,113.985,188.955)';
+ end
end
-end
-obj.data{surfaceIndex}.color = col;
+ obj.data{surfaceIndex}.color = col;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-some settings-%
-obj.data{surfaceIndex}.contour.show = true;
-obj.data{surfaceIndex}.contour.width = 6;
-obj.data{surfaceIndex}.contour.color='rgb(0,0,0)';
-obj.data{surfaceIndex}.flatshading = false;
+ %-some settings-%
+ obj.data{surfaceIndex}.contour.show = true;
+ obj.data{surfaceIndex}.contour.width = 6;
+ obj.data{surfaceIndex}.contour.color = 'rgb(0,0,0)';
+ obj.data{surfaceIndex}.flatshading = false;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-lighting settings-%
-obj.data{surfaceIndex}.lighting.diffuse = 0.8;
-obj.data{surfaceIndex}.lighting.ambient = 0.65;
-obj.data{surfaceIndex}.lighting.specular = 1.42;
-obj.data{surfaceIndex}.lighting.roughness = 0.52;
-obj.data{surfaceIndex}.lighting.fresnel = 0.2;
-obj.data{surfaceIndex}.lighting.vertexnormalsepsilon = 1e-12;
-obj.data{surfaceIndex}.lighting.facenormalsepsilon = 1e-6;
+ %-lighting settings-%
+ obj.data{surfaceIndex}.lighting.diffuse = 0.8;
+ obj.data{surfaceIndex}.lighting.ambient = 0.65;
+ obj.data{surfaceIndex}.lighting.specular = 1.42;
+ obj.data{surfaceIndex}.lighting.roughness = 0.52;
+ obj.data{surfaceIndex}.lighting.fresnel = 0.2;
+ obj.data{surfaceIndex}.lighting.vertexnormalsepsilon = 1e-12;
+ obj.data{surfaceIndex}.lighting.facenormalsepsilon = 1e-6;
-obj.data{surfaceIndex}.lightposition.x = 0;
-obj.data{surfaceIndex}.lightposition.y = 0;
-obj.data{surfaceIndex}.lightposition.z = 0;
+ obj.data{surfaceIndex}.lightposition.x = 0;
+ obj.data{surfaceIndex}.lightposition.y = 0;
+ obj.data{surfaceIndex}.lightposition.z = 0;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-surface name-%
-obj.data{surfaceIndex}.name = bar_data.DisplayName;
+ %-surface name-%
+ obj.data{surfaceIndex}.name = bar_data.DisplayName;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-surface visible-%
-obj.data{surfaceIndex}.visible = strcmp(bar_data.Visible,'on');
+ %-surface visible-%
+ obj.data{surfaceIndex}.visible = strcmp(bar_data.Visible,'on');
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-leg = bar_data.Annotation;
-legInfo = leg.LegendInformation;
+ leg = bar_data.Annotation;
+ legInfo = leg.LegendInformation;
-switch legInfo.IconDisplayStyle
- case 'on'
- showleg = true;
- case 'off'
- showleg = false;
-end
+ switch legInfo.IconDisplayStyle
+ case 'on'
+ showleg = true;
+ case 'off'
+ showleg = false;
+ end
-obj.data{surfaceIndex}.showlegend = showleg;
+ obj.data{surfaceIndex}.showlegend = showleg;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-SETTING SCENE-%
+ %-SETTING SCENE-%
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-aspect ratio-%
-ar = obj.PlotOptions.AspectRatio;
+ %-aspect ratio-%
+ ar = obj.PlotOptions.AspectRatio;
-if ~isempty(ar)
- if ischar(ar)
- scene.aspectmode = ar;
- elseif isvector(ar) && length(ar) == 3
- xar = ar(1);
- yar = ar(2);
- zar = ar(3);
+ if ~isempty(ar)
+ if ischar(ar)
+ scene.aspectmode = ar;
+ elseif isvector(ar) && length(ar) == 3
+ xar = ar(1);
+ yar = ar(2);
+ zar = ar(3);
+ end
+ else
+
+ %-define as default-%
+ xar = max(xedges(:));
+ zar = max(yedges(:));
+ yar = 0.7*max([xar, zar]);
end
-else
- %-define as default-%
- xar = max(xedges(:));
- zar = max(yedges(:));
- yar = 0.7*max([xar, zar]);
-end
+ scene.aspectratio.x = xar;
+ scene.aspectratio.y = yar;
+ scene.aspectratio.z = zar;
-scene.aspectratio.x = xar;
-scene.aspectratio.y = yar;
-scene.aspectratio.z = zar;
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-camera eye-%
+ ey = obj.PlotOptions.CameraEye;
-%-camera eye-%
-ey = obj.PlotOptions.CameraEye;
+ if ~isempty(ey)
+ if isvector(ey) && length(ey) == 3
+ scene.camera.eye.x = ey(1);
+ scene.camera.eye.y = ey(2);
+ scene.camera.eye.z = ey(3);
+ end
+ else
-if ~isempty(ey)
- if isvector(ey) && length(ey) == 3
- scene.camera.eye.x = ey(1);
- scene.camera.eye.y = ey(2);
- scene.camera.eye.z = ey(3);
+ %-define as default-%
+ scene.camera.eye.x = xar + 7;
+ scene.camera.eye.y = yar + 0;
+ scene.camera.eye.z = zar + 0.5;
end
-else
- %-define as default-%
- scene.camera.eye.x = xar + 7;
- scene.camera.eye.y = yar + 0;
- scene.camera.eye.z = zar + 0.5;
-end
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-axis configuration-%
+ scene.xaxis.range = axis_data.XLim(end:-1:1);
+ scene.yaxis.range = axis_data.YLim;
+ scene.zaxis.range = axis_data.ZLim;
-%-axis configuration-%
-scene.xaxis.range = axis_data.XLim(end:-1:1);
-scene.yaxis.range = axis_data.YLim;
-scene.zaxis.range = axis_data.ZLim;
+ scene.xaxis.tickvals = axis_data.XTick;
+ scene.xaxis.ticktext = axis_data.XTickLabel;
-scene.xaxis.tickvals = axis_data.XTick;
-scene.xaxis.ticktext = axis_data.XTickLabel;
+ scene.yaxis.tickvals = axis_data.YTick;
+ scene.yaxis.ticktext = axis_data.YTickLabel;
-scene.yaxis.tickvals = axis_data.YTick;
-scene.yaxis.ticktext = axis_data.YTickLabel;
+ scene.zaxis.tickvals = axis_data.ZTick;
+ scene.zaxis.ticktext = axis_data.ZTickLabel;
-scene.zaxis.tickvals = axis_data.ZTick;
-scene.zaxis.ticktext = axis_data.ZTickLabel;
+ scene.xaxis.zeroline = false;
+ scene.yaxis.zeroline = false;
+ scene.zaxis.zeroline = false;
-scene.xaxis.zeroline = false;
-scene.yaxis.zeroline = false;
-scene.zaxis.zeroline = false;
+ scene.xaxis.showline = true;
+ scene.yaxis.showline = true;
+ scene.zaxis.showline = true;
-scene.xaxis.showline = true;
-scene.yaxis.showline = true;
-scene.zaxis.showline = true;
+ scene.xaxis.tickcolor = 'rgba(0,0,0,1)';
+ scene.yaxis.tickcolor = 'rgba(0,0,0,1)';
+ scene.zaxis.tickcolor = 'rgba(0,0,0,1)';
-scene.xaxis.tickcolor = 'rgba(0,0,0,1)';
-scene.yaxis.tickcolor = 'rgba(0,0,0,1)';
-scene.zaxis.tickcolor = 'rgba(0,0,0,1)';
+ scene.xaxis.ticklabelposition = 'outside';
+ scene.yaxis.ticklabelposition = 'outside';
+ scene.zaxis.ticklabelposition = 'outside';
-scene.xaxis.ticklabelposition = 'outside';
-scene.yaxis.ticklabelposition = 'outside';
-scene.zaxis.ticklabelposition = 'outside';
+ scene.xaxis.title = axis_data.XLabel.String;
+ scene.yaxis.title = axis_data.YLabel.String;
+ scene.zaxis.title = axis_data.ZLabel.String;
-scene.xaxis.title = axis_data.XLabel.String;
-scene.yaxis.title = axis_data.YLabel.String;
-scene.zaxis.title = axis_data.ZLabel.String;
-
-%-------------------------------------------------------------------------%
-
-%-SET SCENE TO LAYOUT-%
-obj.layout = setfield(obj.layout, sprintf('scene%d', xsource), scene);
-
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
+ %-SET SCENE TO LAYOUT-%
+ obj.layout = setfield(obj.layout, sprintf('scene%d', xsource), scene);
end
function bar_ = bar_data(position3d, size_)
- % position3d - 3-list or array of shape (3,) that represents the point of coords (x, y, 0), where a bar is placed
- % size = a 3-tuple whose elements are used to scale a unit cube to get a paralelipipedic bar
- % returns - an array of shape(8,3) representing the 8 vertices of a bar at position3d
+ % position3d - 3-list or array of shape (3,) that represents the point
+ % of coords (x, y, 0), where a bar is placed.
+ % size = a 3-tuple whose elements are used to scale a unit cube to get
+ % a paralelipipedic bar.
+ % returns - an array of shape(8,3) representing the 8 vertices of a bar
+ % at position3d.
if nargin < 2
size_ = [1, 1, 1];
@@ -278,24 +273,24 @@
]; % the vertices of the unit cube
for n =1:size(bar_, 1)
- bar_(n,:) = bar_(n,:) .* size_; % scale the cube to get the vertices of a parallelipipedic bar_
+ % scale the cube to get the vertices of a parallelipipedic bar_
+ bar_(n,:) = bar_(n,:) .* size_;
end
-
- bar_ = bar_ + position3d; %translate each bar_ on the directio OP, with P=position3d
+ %translate each bar_ on the directio OP, with P=position3d
+ bar_ = bar_ + position3d;
end
function [vertices, I, J, K] = triangulate_bar_faces(positions, sizes)
- % positions - array of shape (N, 3) that contains all positions in the plane z=0, where a histogram bar is placed
- % sizes - array of shape (N,3); each row represents the sizes to scale a unit cube to get a bar
- % returns the array of unique vertices, and the lists i, j, k to be used in instantiating the go.Mesh3d class
+ % positions - array of shape (N, 3) that contains all positions in the
+ % plane z=0, where a histogram bar is placed.
+ % sizes - array of shape (N,3); each row represents the sizes to scale
+ % a unit cube to get a bar.
+ % returns the array of unique vertices, and the lists i, j, k to be
+ % used in instantiating the go.Mesh3d class.
if nargin < 2
sizes = ones(size(positions,1), 3); %[(1,1,1)]*len(positions)
- else
- sizes;
- % if isinstance(sizes, (list, np.ndarray)) and len(sizes) != len(positions):
- % raise ValueError('Your positions and sizes lists/arrays do not have the same length')
end
c = 1;
@@ -355,5 +350,4 @@
X = vertices(:,1);
Y = vertices(:,2);
Z = vertices(:,3);
-
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateBarseries.m b/plotly/plotlyfig_aux/handlegraphics/updateBarseries.m
index 70261ec2..9f44c674 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateBarseries.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateBarseries.m
@@ -1,177 +1,155 @@
function obj = updateBarseries(obj,barIndex)
+ % x: ...[DONE]
+ % y: ...[DONE]
+ % name: ...[DONE]
+ % orientation: ...[DONE]
+ % text: ...[NOT SUPPORTED IN MATLAB]
+ % error_y: ...[HANDLED BY ERRORBAR]
+ % error_x: ...[HANDLED BY ERRORBAR]
+ % opacity: ...[DONE]
+ % xaxis: ...[DONE]
+ % yaxis: ...[DONE]
+ % showlegend: ...[DONE]
+ % stream: ...[HANDLED BY PLOTLY STREAM]
+ % visible: ...[DONE]
+ % type: ...[DONE]
+ % r: ...[NA]
+ % t: ...[NA]
+ % textfont: ...[NA]
+
+ % MARKER:
+ % color: ...DONE]
+ % size: ...[NA]
+ % symbol: ...[NA]
+ % opacity: ...[NA]
+ % sizeref: ...[NA]
+ % sizemode: ...[NA]
+ % colorscale: ...[NA]
+ % cauto: ...[NA]
+ % cmin: ...[NA]
+ % cmax: ...[NA]
+ % outliercolor: ...[NA]
+ % maxdisplayed: ...[NA]
+
+ % MARKER LINE:
+ % color: ...[DONE]
+ % width: ...[DONE]
+ % dash: ...[NA]
+ % opacity: ---[TODO]
+ % shape: ...[NA]
+ % smoothing: ...[NA]
+ % outliercolor: ...[NA]
+ % outlierwidth: ...[NA]
+
+ % LINE:
+ % color: ........[N/A]
+ % width: ...[NA]
+ % dash: ...[NA]
+ % opacity: ...[NA]
+ % shape: ...[NA]
+ % smoothing: ...[NA]
+ % outliercolor: ...[NA]
+ % outlierwidth: ...[NA]
+
+ %---------------------------------------------------------------------%
+
+ %-AXIS INDEX-%
+ axIndex = obj.getAxisIndex(obj.State.Plot(barIndex).AssociatedAxis);
+
+ %-BAR DATA STRUCTURE- %
+ bar_data = obj.State.Plot(barIndex).Handle;
+
+ %-BAR CHILD (PATCH) DATA STRUCTURE- %
+ bar_child_data = bar_data.Children(1);
+
+ %-CHECK FOR MULTIPLE AXES-%
+ [xsource, ysource] = findSourceAxis(obj,axIndex);
+
+ %-AXIS DATA-%
+ xaxis = obj.layout.("xaxis" + xsource);
+ yaxis = obj.layout.("yaxis" + ysource);
+
+ %---------------------------------------------------------------------%
+
+ %-bar xaxis and yaxis -%
+ obj.data{barIndex}.xaxis = ['x' num2str(xsource)];
+ obj.data{barIndex}.yaxis = ['y' num2str(ysource)];
+
+ %---------------------------------------------------------------------%
+
+ %-bar visible-%
+ obj.data{barIndex}.visible = strcmp(bar_data.Visible,'on');
+
+ %---------------------------------------------------------------------%
+
+ %-bar type-%
+ obj.data{barIndex}.type = 'bar';
+
+ %---------------------------------------------------------------------%
+
+ %-bar name-%
+ obj.data{barIndex}.name = bar_data.DisplayName;
+
+ %---------------------------------------------------------------------%
+
+ %-layout barmode-%
+ switch bar_data.BarLayout
+ case 'grouped'
+ obj.layout.barmode = 'group';
+ case 'stacked'
+ obj.layout.barmode = 'stack';
+ end
+
+ %---------------------------------------------------------------------%
+
+ %-layout bargroupgap-%
+ obj.layout.bargroupgap = 1-bar_data.BarWidth;
+
+ %---------------------------------------------------------------------%
+
+ %-layout bargap-%
+ obj.layout.bargap = obj.PlotlyDefaults.Bargap;
+
+ %---------------------------------------------------------------------%
+
+ %-bar orientation-%
+ switch bar_data.Horizontal
+ case 'off'
+ obj.data{barIndex}.orientation = 'v';
+ %-bar x and y data-%
+ obj.data{barIndex}.x = bar_data.XData;
+ obj.data{barIndex}.y = bar_data.YData;
+ case 'on'
+ obj.data{barIndex}.orientation = 'h';
+ %-bar x and y data-%
+ obj.data{barIndex}.x = bar_data.YData;
+ obj.data{barIndex}.y = bar_data.XData;
+ end
-% x: ...[DONE]
-% y: ...[DONE]
-% name: ...[DONE]
-% orientation: ...[DONE]
-% text: ...[NOT SUPPORTED IN MATLAB]
-% error_y: ...[HANDLED BY ERRORBAR]
-% error_x: ...[HANDLED BY ERRORBAR]
-% opacity: ...[DONE]
-% xaxis: ...[DONE]
-% yaxis: ...[DONE]
-% showlegend: ...[DONE]
-% stream: ...[HANDLED BY PLOTLY STREAM]
-% visible: ...[DONE]
-% type: ...[DONE]
-% r: ...[NA]
-% t: ...[NA]
-% textfont: ...[NA]
-
-% MARKER:
-% color: ...DONE]
-% size: ...[NA]
-% symbol: ...[NA]
-% opacity: ...[NA]
-% sizeref: ...[NA]
-% sizemode: ...[NA]
-% colorscale: ...[NA]
-% cauto: ...[NA]
-% cmin: ...[NA]
-% cmax: ...[NA]
-% outliercolor: ...[NA]
-% maxdisplayed: ...[NA]
-
-% MARKER LINE:
-% color: ...[DONE]
-% width: ...[DONE]
-% dash: ...[NA]
-% opacity: ---[TODO]
-% shape: ...[NA]
-% smoothing: ...[NA]
-% outliercolor: ...[NA]
-% outlierwidth: ...[NA]
-
-% LINE:
-% color: ........[N/A]
-% width: ...[NA]
-% dash: ...[NA]
-% opacity: ...[NA]
-% shape: ...[NA]
-% smoothing: ...[NA]
-% outliercolor: ...[NA]
-% outlierwidth: ...[NA]
-
-
-%-------------------------------------------------------------------------%
-
-%-AXIS INDEX-%
-axIndex = obj.getAxisIndex(obj.State.Plot(barIndex).AssociatedAxis);
-
-%-BAR DATA STRUCTURE- %
-bar_data = obj.State.Plot(barIndex).Handle;
-
-%-BAR CHILD (PATCH) DATA STRUCTURE- %
-bar_child_data = bar_data.Children(1);
-
-%-CHECK FOR MULTIPLE AXES-%
-[xsource, ysource] = findSourceAxis(obj,axIndex);
-
-%-AXIS DATA-%
-xaxis = obj.layout.("xaxis" + xsource);
-yaxis = obj.layout.("yaxis" + ysource);
-
-%-------------------------------------------------------------------------%
-
-%-bar xaxis-%
-obj.data{barIndex}.xaxis = ['x' num2str(xsource)];
-
-%-------------------------------------------------------------------------%
-
-%-bar yaxis-%
-obj.data{barIndex}.yaxis = ['y' num2str(ysource)];
-
-%-------------------------------------------------------------------------%
-
-%-bar visible-%
-obj.data{barIndex}.visible = strcmp(bar_data.Visible,'on');
-
-%-------------------------------------------------------------------------%
-
-%-bar type-%
-obj.data{barIndex}.type = 'bar';
-
-%-------------------------------------------------------------------------%
-
-%-bar name-%
-obj.data{barIndex}.name = bar_data.DisplayName;
-
-%-------------------------------------------------------------------------%
-
-%-layout barmode-%
-switch bar_data.BarLayout
- case 'grouped'
- obj.layout.barmode = 'group';
- case 'stacked'
- obj.layout.barmode = 'stack';
-end
-
-%-------------------------------------------------------------------------%
-
-%-layout bargroupgap-%
-obj.layout.bargroupgap = 1-bar_data.BarWidth;
-
-%---------------------------------------------------------------------%
-
-%-layout bargap-%
-obj.layout.bargap = obj.PlotlyDefaults.Bargap;
-
-%-------------------------------------------------------------------------%
-
-%-bar orientation-%
-switch bar_data.Horizontal
-
- case 'off'
-
- obj.data{barIndex}.orientation = 'v';
-
- %-bar x data-%
- obj.data{barIndex}.x = bar_data.XData;
-
- %-bar y data-%
- obj.data{barIndex}.y = bar_data.YData;
-
-
- case 'on'
-
- obj.data{barIndex}.orientation = 'h';
-
- %-bar x data-%
- obj.data{barIndex}.x = bar_data.YData;
-
- %-bar y data-%
- obj.data{barIndex}.y = bar_data.XData;
-end
-
-%---------------------------------------------------------------------%
-
-%-bar showlegend-%
-leg = bar_data.Annotation;
-legInfo = leg.LegendInformation;
+ %---------------------------------------------------------------------%
-switch legInfo.IconDisplayStyle
- case 'on'
- showleg = true;
- case 'off'
- showleg = false;
-end
-
-obj.data{barIndex}.showlegend = showleg;
+ %-bar showlegend-%
+ leg = bar_data.Annotation;
+ legInfo = leg.LegendInformation;
-%-------------------------------------------------------------------------%
+ switch legInfo.IconDisplayStyle
+ case 'on'
+ showleg = true;
+ case 'off'
+ showleg = false;
+ end
-%-bar opacity-%
-if ~ischar(bar_child_data.FaceAlpha)
- obj.data{barIndex}.opacity = bar_child_data.FaceAlpha;
-end
+ obj.data{barIndex}.showlegend = showleg;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-bar marker-%
-obj.data{barIndex}.marker = extractPatchFace(bar_child_data);
+ %-bar opacity-%
+ if ~ischar(bar_child_data.FaceAlpha)
+ obj.data{barIndex}.opacity = bar_child_data.FaceAlpha;
+ end
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
+ %-bar marker-%
+ obj.data{barIndex}.marker = extractPatchFace(bar_child_data);
end
-
-
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateBaseline.m b/plotly/plotlyfig_aux/handlegraphics/updateBaseline.m
index 8f9fbfd8..d6a25876 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateBaseline.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateBaseline.m
@@ -1,19 +1,13 @@
function obj = updateBaseline(obj, baseIndex)
+ %-UPDATE LINESERIES-%
+ updateLineseries(obj, baseIndex);
-%-------------------------------------------------------------------------%
+ %-baseline showlegend-%
+ obj.data{baseIndex}.showlegend = obj.PlotlyDefaults.ShowBaselineLegend;
-%-UPDATE LINESERIES-%
-updateLineseries(obj, baseIndex);
-
-%-------------------------------------------------------------------------%
-
-%-baseline showlegend-%
-obj.data{baseIndex}.showlegend = obj.PlotlyDefaults.ShowBaselineLegend;
-
-%-CHECK FOR MULTIPLE BASELINES-%
-if isMultipleBaseline(obj,baseIndex)
- %-hide baseline if mutliple-%
- obj.data{baseIndex}.visible = false;
+ %-CHECK FOR MULTIPLE BASELINES-%
+ if isMultipleBaseline(obj, baseIndex)
+ %-hide baseline if mutliple-%
+ obj.data{baseIndex}.visible = false;
+ end
end
-
-end
\ No newline at end of file
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateBoxplot.m b/plotly/plotlyfig_aux/handlegraphics/updateBoxplot.m
index 49a01f4c..f898951a 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateBoxplot.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateBoxplot.m
@@ -1,306 +1,278 @@
function obj = updateBoxplot(obj, boxIndex)
+ % y: ...[DONE]
+ % x0: ...[DONE]
+ % x: ...[DONE]
+ % name: ...[DONE]
+ % boxmean: ...[NOT SUPPORTED IN MATLAB]
+ % boxpoints: ...[NOT SUPPORTED IN MATLAB]
+ % jitter: ...[NOT SUPPORTED IN MATLAB]
+ % pointpos: ...[NOT SUPPORTED IN MATLAB]
+ % whiskerwidth: ........................[TODO]
+ % fillcolor: ...[DONE]
+ % opacity: ---[TODO]
+ % xaxis: ...[DONE]
+ % yaxis: ...[DONE]
+ % showlegend: ...[DONE]
+ % stream: ...[HANDLED BY PLOTLY STREAM]
+ % visible: ...[DONE]
+ % type: ...[DONE]
+
+ % MARKER
+ % color: ...[NA]
+ % width: ...[NA]
+ % dash: ...[NA]
+ % opacity: ...[NA]
+ % shape: ...[NA]
+ % smoothing: ...[NA]
+ % outliercolor: ...[NOT SUPPORTED IN MATLAB]
+ % outlierwidth: ...[NOT SUPPORTED IN MATLAB]
+
+ % LINE
+ % color: ...[DONE]
+ % width: ...[DONE]
+ % dash: ...[DONE]
+ % opacity: ---[TODO]
+ % shape: ...[DONE]
+ % smoothing: ...[NOT SUPPORTED IN MATLAB]
-% y: ...[DONE]
-% x0: ...[DONE]
-% x: ...[DONE]
-% name: ...[DONE]
-% boxmean: ...[NOT SUPPORTED IN MATLAB]
-% boxpoints: ...[NOT SUPPORTED IN MATLAB]
-% jitter: ...[NOT SUPPORTED IN MATLAB]
-% pointpos: ...[NOT SUPPORTED IN MATLAB]
-% whiskerwidth: ........................[TODO]
-% fillcolor: ...[DONE]
-% opacity: ---[TODO]
-% xaxis: ...[DONE]
-% yaxis: ...[DONE]
-% showlegend: ...[DONE]
-% stream: ...[HANDLED BY PLOTLY STREAM]
-% visible: ...[DONE]
-% type: ...[DONE]
-
-% MARKER
-% color: ...[NA]
-% width: ...[NA]
-% dash: ...[NA]
-% opacity: ...[NA]
-% shape: ...[NA]
-% smoothing: ...[NA]
-% outliercolor: ...[NOT SUPPORTED IN MATLAB]
-% outlierwidth: ...[NOT SUPPORTED IN MATLAB]
-
-% LINE
-% color: ...[DONE]
-% width: ...[DONE]
-% dash: ...[DONE]
-% opacity: ---[TODO]
-% shape: ...[DONE]
-% smoothing: ...[NOT SUPPORTED IN MATLAB]
-
-%-------------------------------------------------------------------------%
-
-%-AXIS INDEX-%
-axIndex = obj.getAxisIndex(obj.State.Plot(boxIndex).AssociatedAxis);
-
-%-BOX DATA STRUCTURE-%
-box_data = obj.State.Plot(boxIndex).Handle;
-
-%-BOX CHILDREN-%
-box_child = box_data.Children;
-
-%-------------------------------------------------------------------------%
-
-%-CONFIRM PROPER BOXPLOT STRUCTURE-%
-
-% check for compact boxplot
-isCompact = ~isempty(findobj(obj.State.Plot(boxIndex).Handle,'Tag','Whisker'));
-
-% number of boxplots
-if isCompact
- bpcompnum = 6;
- bpnum = length(box_child)/bpcompnum;
- % check for assumed box structure
- if mod(length(box_child), bpcompnum)~=0
- updateAlternativeBoxplot(obj, boxIndex);
- return
- end
-else
- bpcompnum = 8;
- bpnum = length(box_child)/bpcompnum;
- % check for assumed box structure
- if mod(length(box_child),bpcompnum)~=0
- updateAlternativeBoxplot(obj, boxIndex);
- return
- end
-end
+ %---------------------------------------------------------------------%
-% initialize ydata
-ydata = [];
+ %-AXIS INDEX-%
+ axIndex = obj.getAxisIndex(obj.State.Plot(boxIndex).AssociatedAxis);
-%-------------------------------------------------------------------------%
+ %-BOX DATA STRUCTURE-%
+ box_data = obj.State.Plot(boxIndex).Handle;
-%-box groupgap-%
-obj.layout.bargroupgap = 1/bpnum;
+ %-BOX CHILDREN-%
+ box_child = box_data.Children;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-box name-%
-obj.data{boxIndex}.name = box_data.DisplayName;
+ %-CONFIRM PROPER BOXPLOT STRUCTURE-%
-%-------------------------------------------------------------------------%
+ % check for compact boxplot
+ isCompact = ~isempty(findobj(obj.State.Plot(boxIndex).Handle, ...
+ 'Tag','Whisker'));
+
+ % number of boxplots
+ if isCompact
+ bpcompnum = 6;
+ bpnum = length(box_child)/bpcompnum;
+ % check for assumed box structure
+ if mod(length(box_child), bpcompnum) ~= 0
+ updateAlternativeBoxplot(obj, boxIndex);
+ return
+ end
+ else
+ bpcompnum = 8;
+ bpnum = length(box_child)/bpcompnum;
+ % check for assumed box structure
+ if mod(length(box_child),bpcompnum) ~= 0
+ updateAlternativeBoxplot(obj, boxIndex);
+ return
+ end
+ end
+
+ % initialize ydata
+ ydata = [];
-% iterate through box plot children in reverse order
-for bp = bpnum:-1:1
-
- %-CHECK FOR MULTIPLE AXES-%
- [xsource, ysource] = findSourceAxis(obj,axIndex);
-
- %-AXIS DATA-%
- xaxis = obj.layout.("xaxis" + xsource);
- yaxis = obj.layout.("yaxis" + ysource);
-
- %---------------------------------------------------------------------%
-
- %-box xaxis-%
- obj.data{boxIndex}.xaxis = ['x' num2str(xsource)];
-
- %---------------------------------------------------------------------%
-
- %-box yaxis-%
- obj.data{boxIndex}.yaxis = ['y' num2str(ysource)];
-
- %---------------------------------------------------------------------%
-
- %-box type-%
- obj.data{boxIndex}.type = 'box';
-
%---------------------------------------------------------------------%
-
- %-box visible-%
- obj.data{boxIndex}.visible = strcmp(box_data.Visible,'on');
-
+
+ %-box groupgap-%
+ obj.layout.bargroupgap = 1/bpnum;
+
%---------------------------------------------------------------------%
-
- %-box fillcolor-%
- obj.data{boxIndex}.fillcolor = 'rgba(0, 0, 0, 0)';
-
+
+ %-box name-%
+ obj.data{boxIndex}.name = box_data.DisplayName;
+
%---------------------------------------------------------------------%
-
- %-box showlegend-%
- leg = box_data.Annotation;
- legInfo = leg.LegendInformation;
-
- switch legInfo.IconDisplayStyle
- case 'on'
- showleg = true;
- case 'off'
- showleg = false;
- end
-
- obj.data{boxIndex}.showlegend = showleg;
-
- %-boxplot components-%
- Q1 = [];
- Q3 = [];
- median = [];
- outliers = [];
- uwhisker = [];
- lwhisker = [];
-
- % iterate through boxplot components
- for bpc = 1:bpcompnum
+
+ % iterate through box plot children in reverse order
+ for bp = bpnum:-1:1
- %get box child data
- box_child_data = box_child(bp+bpnum*(bpc-1));
+ %-CHECK FOR MULTIPLE AXES-%
+ [xsource, ysource] = findSourceAxis(obj,axIndex);
- %box name
- if strcmp(box_child_data.Type,'text')
- if iscell(box_child_data.String)
- boxname = box_child_data.String{1};
- else
- boxname = box_child_data.String;
- end
+ %-AXIS DATA-%
+ xaxis = obj.layout.("xaxis" + xsource);
+ yaxis = obj.layout.("yaxis" + ysource);
+
+ %-----------------------------------------------------------------%
+
+ %-box xaxis and yaxis-%
+ obj.data{boxIndex}.xaxis = ['x' num2str(xsource)];
+ obj.data{boxIndex}.yaxis = ['y' num2str(ysource)];
+
+ %-----------------------------------------------------------------%
+
+ %-box type-%
+ obj.data{boxIndex}.type = 'box';
+
+ %-----------------------------------------------------------------%
+
+ %-box visible-%
+ obj.data{boxIndex}.visible = strcmp(box_data.Visible,'on');
+
+ %-----------------------------------------------------------------%
+
+ %-box fillcolor-%
+ obj.data{boxIndex}.fillcolor = 'rgba(0, 0, 0, 0)';
+
+ %-----------------------------------------------------------------%
+
+ %-box showlegend-%
+ leg = box_data.Annotation;
+ legInfo = leg.LegendInformation;
+
+ switch legInfo.IconDisplayStyle
+ case 'on'
+ showleg = true;
+ case 'off'
+ showleg = false;
end
- % parse boxplot tags
- switch box_child_data.Tag
-
- %-median-%
- case 'Median'
-
- median = box_child_data.YData(1);
-
- %-upper whisker-%
- case 'Upper Whisker'
-
- uwhisker = box_child_data.YData(2);
-
- %-boxplot whisker width-%
- obj.data{boxIndex}.whiskerwidth = 1;
-
- %-lower whisker-%
- case 'Lower Whisker'
-
- lwhisker = box_child_data.YData(1);
-
- case 'Box'
-
- %-Q1-%
- Q1 = min(box_child_data.YData);
-
- %-Q3-%
- Q3 = max(box_child_data.YData);
-
- %-boxplot line style-%
-
- if isCompact
- col = 255*box_child_data.Color;
- obj.data{boxIndex}.fillcolor = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];
+ obj.data{boxIndex}.showlegend = showleg;
+
+ %-boxplot components-%
+ Q1 = [];
+ Q3 = [];
+ median = [];
+ outliers = [];
+ uwhisker = [];
+ lwhisker = [];
+
+ % iterate through boxplot components
+ for bpc = 1:bpcompnum
+ %get box child data
+ box_child_data = box_child(bp+bpnum*(bpc-1));
+
+ %box name
+ if strcmp(box_child_data.Type,'text')
+ if iscell(box_child_data.String)
+ boxname = box_child_data.String{1};
else
- obj.data{boxIndex}.line = extractLineLine(box_child_data);
+ boxname = box_child_data.String;
end
-
-
- %-outliers-%
- case 'Outliers'
-
- if ~isnan(box_child_data.YData)
- %-outlier marker data-%
- outliers = box_child_data.YData;
+ end
+
+ % parse boxplot tags
+ switch box_child_data.Tag
+ case 'Median'
+ median = box_child_data.YData(1);
+ case 'Upper Whisker'
+ uwhisker = box_child_data.YData(2);
- %-outlier marker style-%
- obj.data{boxIndex}.marker = extractLineMarker(box_child_data);
- end
-
- %-compact whiskers-%
- case 'Whisker'
-
- %-boxplot line style-%
- obj.data{boxIndex}.line = extractLineLine(box_child_data);
-
- %-boxplot whisker width-%
- obj.data{boxIndex}.whiskerwidth = 0;
-
- %-whisker data-%
- uwhisker = box_child_data.YData(2);
- lwhisker = box_child_data.YData(1);
-
- %-compact median-%
- case 'MedianInner'
-
- median = box_child_data.YData(1);
-
+ %-boxplot whisker width-%
+ obj.data{boxIndex}.whiskerwidth = 1;
+ case 'Lower Whisker'
+ lwhisker = box_child_data.YData(1);
+ case 'Box'
+ Q1 = min(box_child_data.YData);
+ Q3 = max(box_child_data.YData);
+
+ %-boxplot line style-%
+ if isCompact
+ col = 255*box_child_data.Color;
+ obj.data{boxIndex}.fillcolor = ...
+ sprintf("rgb(%f,%f,%f)", col);
+ else
+ obj.data{boxIndex}.line = ...
+ extractLineLine(box_child_data);
+ end
+ case 'Outliers'
+ if ~isnan(box_child_data.YData)
+ %-outlier marker data-%
+
+ outliers = box_child_data.YData;
+ %-outlier marker style-%
+ obj.data{boxIndex}.marker = ...
+ extractLineMarker(box_child_data);
+ end
+ case 'Whisker'
+ %-boxplot line style-%
+ obj.data{boxIndex}.line = ...
+ extractLineLine(box_child_data);
+
+ %-boxplot whisker width-%
+ obj.data{boxIndex}.whiskerwidth = 0;
+
+ %-whisker data-%
+ uwhisker = box_child_data.YData(2);
+ lwhisker = box_child_data.YData(1);
+ case 'MedianInner'
+ median = box_child_data.YData(1);
+ end
end
- end
-
- %-generate boxplot data-%
- gendata = generateBoxData(outliers, lwhisker, Q1, median, Q3, uwhisker);
-
- %-boxplot y-data-%
- obj.data{boxIndex}.y(length(ydata)+1:length(ydata)+length(gendata)) = ...
- generateBoxData(outliers, lwhisker, Q1, median, Q3, uwhisker);
-
- %-boxplot x-data-%
- if (bpnum > 1)
- for n = (length(ydata)+1):(length(ydata)+length(gendata))
- obj.data{boxIndex}.x{n} = boxname;
+
+ %-generate boxplot data-%
+ gendata = generateBoxData(outliers, lwhisker, Q1, median, Q3, ...
+ uwhisker);
+
+ %-boxplot y-data-%
+ obj.data{boxIndex}.y(length(ydata)+1:length(ydata)+length(gendata)) = ...
+ generateBoxData(outliers, lwhisker, Q1, median, Q3, uwhisker);
+
+ %-boxplot x-data-%
+ if (bpnum > 1)
+ for n = (length(ydata)+1):(length(ydata)+length(gendata))
+ obj.data{boxIndex}.x{n} = boxname;
+ end
end
- end
-
- %-update ydata-%
- ydata = obj.data{boxIndex}.y;
-
-end
-%----------------------------!AXIS UPDATE!--------------------------------%
+ %-update ydata-%
+ ydata = obj.data{boxIndex}.y;
+ end
-% take first text object as prototype for axis tick style/layout
-text_child = findobj(obj.State.Plot(boxIndex).Handle,'Type','text');
+ %----------------------------!AXIS UPDATE!----------------------------%
-%-STANDARDIZE UNITS-%
-fontunits = text_child(1).FontUnits;
-set(text_child(1),'FontUnits','points');
+ % take first text object as prototype for axis tick style/layout
+ text_child = findobj(obj.State.Plot(boxIndex).Handle, 'Type', 'text');
-%-text data -%
-text_data = text_child(1);
+ %-STANDARDIZE UNITS-%
+ fontunits = text_child(1).FontUnits;
+ set(text_child(1), 'FontUnits', 'points');
-%-------------------------------------------------------------------------%
+ %-text data -%
+ text_data = text_child(1);
-%-xaxis tick font size-%
-xaxis.tickfont.size = text_data.FontSize;
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-xaxis tick font size-%
+ xaxis.tickfont.size = text_data.FontSize;
-%-xaxis tick font family-%
-xaxis.tickfont.family = matlab2plotlyfont(text_data.FontName);
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-xaxis tick font family-%
+ xaxis.tickfont.family = matlab2plotlyfont(text_data.FontName);
-%-xaxis tick font color-%
-xaxis.tickfont.color = text_data.Color;
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-xaxis tick font color-%
+ xaxis.tickfont.color = text_data.Color;
-%-axis type-%
-xaxis.type = 'category';
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-axis type-%
+ xaxis.type = 'category';
-%-show tick labels-%
-xaxis.showticklabels = true;
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-show tick labels-%
+ xaxis.showticklabels = true;
-%-autorange-%
-xaxis.autorange = true;
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-autorange-%
+ xaxis.autorange = true;
-%-set the layout axis field-%
-obj.layout = setfield(obj.layout,['xaxis' num2str(xsource)],xaxis);
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-set the layout axis field-%
+ obj.layout = setfield(obj.layout,['xaxis' num2str(xsource)],xaxis);
-%-REVERT UNITS-%
-set(text_child(1),'FontUnits',fontunits);
+ %---------------------------------------------------------------------%
+ %-REVERT UNITS-%
+ set(text_child(1),'FontUnits',fontunits);
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateCategoricalHistogram.m b/plotly/plotlyfig_aux/handlegraphics/updateCategoricalHistogram.m
index e84cd3c9..7076f9eb 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateCategoricalHistogram.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateCategoricalHistogram.m
@@ -1,145 +1,137 @@
function obj = updateCategoricalHistogram(obj,histIndex)
+ % x:...[DONE]
+ % y:...[DONE]
+ % histnorm:...[DONE]
+ % name:...[DONE]
+ % autobinx:...[DONE]
+ % nbinsx:...[DONE]
+ % xbins:...[DONE]
+ % autobiny:...[DONE]
+ % nbinsy:...[DONE]
+ % ybins:...[DONE]
+ % text:...[NOT SUPPORTED IN MATLAB]
+ % error_y:...[HANDLED BY ERRORBARSERIES]
+ % error_x:...[HANDLED BY ERRORBARSERIES]
+ % opacity: --- [TODO]
+ % xaxis:...[DONE]
+ % yaxis:...[DONE]
+ % showlegend:...[DONE]
+ % stream:...[HANDLED BY PLOTLYSTREAM]
+ % visible:...[DONE]
+ % type:...[DONE]
+ % orientation:...[DONE]
+
+ % MARKER:
+ % color: ...[DONE]
+ % size: ...[NA]
+ % symbol: ...[NA]
+ % opacity: ...[TODO]
+ % sizeref: ...[NA]
+ % sizemode: ...[NA]
+ % colorscale: ...[NA]
+ % cauto: ...[NA]
+ % cmin: ...[NA]
+ % cmax: ...[NA]
+ % outliercolor: ...[NA]
+ % maxdisplayed: ...[NA]
+
+ % MARKER LINE:
+ % color: ...[DONE]
+ % width: ...[DONE]
+ % dash: ...[NA]
+ % opacity: ...[TODO]
+ % shape: ...[NA]
+ % smoothing: ...[NA]
+ % outliercolor: ...[NA]
+ % outlierwidth: ...[NA]
+
+ %---------------------------------------------------------------------%
+
+ %-AXIS INDEX-%
+ axIndex = obj.getAxisIndex(obj.State.Plot(histIndex).AssociatedAxis);
+
+ %-HIST DATA STRUCTURE- %
+ hist_data = obj.State.Plot(histIndex).Handle;
+
+ %-CHECK FOR MULTIPLE AXES-%
+ [xsource, ysource] = findSourceAxis(obj,axIndex);
+
+ %-AXIS DATA-%
+ xaxis = obj.layout.("xaxis" + xsource);
+ yaxis = obj.layout.("yaxis" + ysource);
+
+ %---------------------------------------------------------------------%
+
+ %-hist xaxis and yaxis-%
+ obj.data{histIndex}.xaxis = ['x' num2str(xsource)];
+ obj.data{histIndex}.yaxis = ['y' num2str(ysource)];
+
+ %---------------------------------------------------------------------%
+
+ %-bar type-%
+ obj.data{histIndex}.type = 'bar';
+
+ %---------------------------------------------------------------------%
+
+ %-hist data-%
+ obj.data{histIndex}.width = hist_data.BarWidth;
+ obj.data{histIndex}.y = hist_data.Values;
+
+ %---------------------------------------------------------------------%
+
+ %-hist categorical layout on x-axis-%
+ gap = 1 - hist_data.BarWidth;
+ xmin = -gap;
+ xmax = (hist_data.NumDisplayBins - 1) + gap;
+
+ t = 'category';
+ obj.layout.("xaxis" + xsource).type = t;
+ obj.layout.("xaxis" + xsource).autotick = false;
+ obj.layout.("xaxis" + xsource).range = {xmin, xmax};
+
+ %---------------------------------------------------------------------%
+
+ %-hist name-%
+ obj.data{histIndex}.name = hist_data.DisplayName;
+
+ %---------------------------------------------------------------------%
+
+ %-layout barmode-%
+ obj.layout.barmode = 'group';
+
+ %---------------------------------------------------------------------%
+
+ %-hist line width-%
+ obj.data{histIndex}.marker.line.width = hist_data.LineWidth;
-% x:...[DONE]
-% y:...[DONE]
-% histnorm:...[DONE]
-% name:...[DONE]
-% autobinx:...[DONE]
-% nbinsx:...[DONE]
-% xbins:...[DONE]
-% autobiny:...[DONE]
-% nbinsy:...[DONE]
-% ybins:...[DONE]
-% text:...[NOT SUPPORTED IN MATLAB]
-% error_y:...[HANDLED BY ERRORBARSERIES]
-% error_x:...[HANDLED BY ERRORBARSERIES]
-% opacity: --- [TODO]
-% xaxis:...[DONE]
-% yaxis:...[DONE]
-% showlegend:...[DONE]
-% stream:...[HANDLED BY PLOTLYSTREAM]
-% visible:...[DONE]
-% type:...[DONE]
-% orientation:...[DONE]
-
-% MARKER:
-% color: ...[DONE]
-% size: ...[NA]
-% symbol: ...[NA]
-% opacity: ...[TODO]
-% sizeref: ...[NA]
-% sizemode: ...[NA]
-% colorscale: ...[NA]
-% cauto: ...[NA]
-% cmin: ...[NA]
-% cmax: ...[NA]
-% outliercolor: ...[NA]
-% maxdisplayed: ...[NA]
-
-% MARKER LINE:
-% color: ...[DONE]
-% width: ...[DONE]
-% dash: ...[NA]
-% opacity: ...[TODO]
-% shape: ...[NA]
-% smoothing: ...[NA]
-% outliercolor: ...[NA]
-% outlierwidth: ...[NA]
-
-%-------------------------------------------------------------------------%
-
-%-AXIS INDEX-%
-axIndex = obj.getAxisIndex(obj.State.Plot(histIndex).AssociatedAxis);
-
-%-HIST DATA STRUCTURE- %
-hist_data = obj.State.Plot(histIndex).Handle;
-
-%-CHECK FOR MULTIPLE AXES-%
-[xsource, ysource] = findSourceAxis(obj,axIndex);
-
-%-AXIS DATA-%
-xaxis = obj.layout.("xaxis" + xsource);
-yaxis = obj.layout.("yaxis" + ysource);
-
-%-------------------------------------------------------------------------%
-
-%-hist xaxis-%
-obj.data{histIndex}.xaxis = ['x' num2str(xsource)];
-
-%-------------------------------------------------------------------------%
-
-%-hist yaxis-%
-obj.data{histIndex}.yaxis = ['y' num2str(ysource)];
-
-%-------------------------------------------------------------------------%
-
-%-bar type-%
-obj.data{histIndex}.type = 'bar';
-
-%-------------------------------------------------------------------------%
-
-%-hist data-%
-obj.data{histIndex}.width = hist_data.BarWidth;
-obj.data{histIndex}.y = hist_data.Values;
-
-%-------------------------------------------------------------------------%
-
-%-hist categorical layout on x-axis-%
-gap = 1 - hist_data.BarWidth;
-xmin = -gap;
-xmax = (hist_data.NumDisplayBins - 1) + gap;
-
-t = 'category';
-obj.layout.("xaxis" + xsource).type = t;
-obj.layout.("xaxis" + xsource).autotick = false;
-obj.layout.("xaxis" + xsource).range = {xmin, xmax};
-
-%-------------------------------------------------------------------------%
-
-%-hist name-%
-obj.data{histIndex}.name = hist_data.DisplayName;
-
-%-------------------------------------------------------------------------%
-
-%-layout barmode-%
-obj.layout.barmode = 'group';
-
-%-------------------------------------------------------------------------%
-
-%-hist line width-%
-obj.data{histIndex}.marker.line.width = hist_data.LineWidth;
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-hist opacity-%
+ if ~ischar(hist_data.FaceAlpha)
+ obj.data{histIndex}.opacity = 1.25*hist_data.FaceAlpha;
+ end
-%-hist opacity-%
-if ~ischar(hist_data.FaceAlpha)
- obj.data{histIndex}.opacity = 1.25*hist_data.FaceAlpha;
-end
-
-%-------------------------------------------------------------------------%
-
-obj.data{histIndex}.marker = extractPatchFace(hist_data);
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ obj.data{histIndex}.marker = extractPatchFace(hist_data);
-%-hist visible-%
-obj.data{histIndex}.visible = strcmp(hist_data.Visible,'on');
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-hist visible-%
+ obj.data{histIndex}.visible = strcmp(hist_data.Visible,'on');
-%-hist showlegend-%
-leg = hist_data.Annotation;
-legInfo = leg.LegendInformation;
-
-switch legInfo.IconDisplayStyle
- case 'on'
- showleg = true;
- case 'off'
- showleg = false;
-end
+ %---------------------------------------------------------------------%
-obj.data{histIndex}.showlegend = showleg;
+ %-hist showlegend-%
+ leg = hist_data.Annotation;
+ legInfo = leg.LegendInformation;
-%-------------------------------------------------------------------------%
+ switch legInfo.IconDisplayStyle
+ case 'on'
+ showleg = true;
+ case 'off'
+ showleg = false;
+ end
+ obj.data{histIndex}.showlegend = showleg;
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateComet.m b/plotly/plotlyfig_aux/handlegraphics/updateComet.m
index 2c62bc4d..f635025e 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateComet.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateComet.m
@@ -1,355 +1,347 @@
function updateComet(obj,plotIndex)
+ %----SCATTER FIELDS----%
+
+ % x - [DONE]
+ % y - [DONE]
+ % r - [HANDLED BY SCATTER]
+ % t - [HANDLED BY SCATTER]
+ % mode - [DONE]
+ % name - [NOT SUPPORTED IN MATLAB]
+ % text - [DONE]
+ % error_y - [HANDLED BY ERRORBAR]
+ % error_x - [NOT SUPPORTED IN MATLAB]
+ % connectgaps - [NOT SUPPORTED IN MATLAB]
+ % fill - [HANDLED BY AREA]
+ % fillcolor - [HANDLED BY AREA]
+ % opacity --- [TODO]
+ % textfont - [NOT SUPPORTED IN MATLAB]
+ % textposition - [NOT SUPPORTED IN MATLAB]
+ % xaxis [DONE]
+ % yaxis [DONE]
+ % showlegend [DONE]
+ % stream - [HANDLED BY PLOTLYSTREAM]
+ % visible [DONE]
+ % type [DONE]
+
+ % MARKER
+ % marler.color - [DONE]
+ % marker.size - [DONE]
+ % marker.line.color - [DONE]
+ % marker.line.width - [DONE]
+ % marker.line.dash - [NOT SUPPORTED IN MATLAB]
+ % marker.line.opacity - [NOT SUPPORTED IN MATLAB]
+ % marker.line.smoothing - [NOT SUPPORTED IN MATLAB]
+ % marker.line.shape - [NOT SUPPORTED IN MATLAB]
+ % marker.opacity --- [TODO]
+ % marker.colorscale - [NOT SUPPORTED IN MATLAB]
+ % marker.sizemode - [NOT SUPPORTED IN MATLAB]
+ % marker.sizeref - [NOT SUPPORTED IN MATLAB]
+ % marker.maxdisplayed - [NOT SUPPORTED IN MATLAB]
+
+ % LINE
+
+ % line.color - [DONE]
+ % line.width - [DONE]
+ % line.dash - [DONE]
+ % line.opacity --- [TODO]
+ % line.smoothing - [NOT SUPPORTED IN MATLAB]
+ % line.shape - [NOT SUPPORTED IN MATLAB]
-%----SCATTER FIELDS----%
-
-% x - [DONE]
-% y - [DONE]
-% r - [HANDLED BY SCATTER]
-% t - [HANDLED BY SCATTER]
-% mode - [DONE]
-% name - [NOT SUPPORTED IN MATLAB]
-% text - [DONE]
-% error_y - [HANDLED BY ERRORBAR]
-% error_x - [NOT SUPPORTED IN MATLAB]
-% connectgaps - [NOT SUPPORTED IN MATLAB]
-% fill - [HANDLED BY AREA]
-% fillcolor - [HANDLED BY AREA]
-% opacity --- [TODO]
-% textfont - [NOT SUPPORTED IN MATLAB]
-% textposition - [NOT SUPPORTED IN MATLAB]
-% xaxis [DONE]
-% yaxis [DONE]
-% showlegend [DONE]
-% stream - [HANDLED BY PLOTLYSTREAM]
-% visible [DONE]
-% type [DONE]
-
-% MARKER
-% marler.color - [DONE]
-% marker.size - [DONE]
-% marker.line.color - [DONE]
-% marker.line.width - [DONE]
-% marker.line.dash - [NOT SUPPORTED IN MATLAB]
-% marker.line.opacity - [NOT SUPPORTED IN MATLAB]
-% marker.line.smoothing - [NOT SUPPORTED IN MATLAB]
-% marker.line.shape - [NOT SUPPORTED IN MATLAB]
-% marker.opacity --- [TODO]
-% marker.colorscale - [NOT SUPPORTED IN MATLAB]
-% marker.sizemode - [NOT SUPPORTED IN MATLAB]
-% marker.sizeref - [NOT SUPPORTED IN MATLAB]
-% marker.maxdisplayed - [NOT SUPPORTED IN MATLAB]
-
-% LINE
-
-% line.color - [DONE]
-% line.width - [DONE]
-% line.dash - [DONE]
-% line.opacity --- [TODO]
-% line.smoothing - [NOT SUPPORTED IN MATLAB]
-% line.shape - [NOT SUPPORTED IN MATLAB]
-
-%-------------------------------------------------------------------------%
-
-axisData = obj.State.Plot(plotIndex).AssociatedAxis;
-%-AXIS INDEX-%
-axIndex = obj.getAxisIndex(axisData);
-
-%-PLOT DATA STRUCTURE- %
-plotData = obj.State.Plot(plotIndex).Handle;
-
-animObjs = obj.State.Plot(plotIndex).AssociatedAxis.Children;
-
-for i=1:numel(animObjs)
- if isequaln(animObjs(i),plotData)
- animObj = animObjs(i);
- end
- if strcmpi(animObjs(i).Tag,'tail')
- tail = animObjs(i);
- end
- if strcmpi(animObjs(i).Tag,'body')
- body = animObjs(i);
- end
-end
-
-%-CHECK FOR MULTIPLE AXES-%
-[xsource, ysource] = findSourceAxis(obj,axIndex);
+ %---------------------------------------------------------------------%
-%-AXIS DATA-%
-xaxis = obj.layout.("xaxis" + xsource);
-yaxis = obj.layout.("yaxis" + ysource);
+ axisData = obj.State.Plot(plotIndex).AssociatedAxis;
+ %-AXIS INDEX-%
+ axIndex = obj.getAxisIndex(axisData);
-%-------------------------------------------------------------------------%
+ %-PLOT DATA STRUCTURE- %
+ plotData = obj.State.Plot(plotIndex).Handle;
-%-getting data-%
-[x,y,z] = getpoints(tail);
+ animObjs = obj.State.Plot(plotIndex).AssociatedAxis.Children;
-%-------------------------------------------------------------------------%
+ for i=1:numel(animObjs)
+ if isequaln(animObjs(i),plotData)
+ animObj = animObjs(i);
+ end
+ if strcmpi(animObjs(i).Tag,'tail')
+ tail = animObjs(i);
+ end
+ if strcmpi(animObjs(i).Tag,'body')
+ body = animObjs(i);
+ end
+ end
-%-scatter xaxis-%
-obj.data{plotIndex}.xaxis = ['x' num2str(xsource)];
+ %-CHECK FOR MULTIPLE AXES-%
+ [xsource, ysource] = findSourceAxis(obj,axIndex);
-%-------------------------------------------------------------------------%
+ %-AXIS DATA-%
+ xaxis = obj.layout.("xaxis" + xsource);
+ yaxis = obj.layout.("yaxis" + ysource);
-%-scatter yaxis-%
-obj.data{plotIndex}.yaxis = ['y' num2str(ysource)];
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-getting data-%
+ [x,y,z] = getpoints(tail);
-%-scatter type-%
-obj.data{plotIndex}.type = 'scatter';
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-scatter xaxis and yaxis-%
+ obj.data{plotIndex}.xaxis = ['x' num2str(xsource)];
+ obj.data{plotIndex}.yaxis = ['y' num2str(ysource)];
-%-scatter visible-%
-obj.data{plotIndex}.visible = strcmp(plotData.Visible,'on');
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-scatter type-%
+ obj.data{plotIndex}.type = 'scatter';
-%-scatter x-%
-obj.data{plotIndex}.x = x(1);
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-scatter visible-%
+ obj.data{plotIndex}.visible = strcmp(plotData.Visible,'on');
-%-scatter y-%
-obj.data{plotIndex}.y = y(1);
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-scatter x-%
+ obj.data{plotIndex}.x = x(1);
-%-For 3D plots-%
-obj.PlotOptions.is3d = false; % by default
+ %---------------------------------------------------------------------%
-nSet = unique(z);
-if numel(nSet)>1
- if any(z)
- %-scatter z-%
- obj.data{plotIndex}.z = z(1);
-
- %-overwrite type-%
- obj.data{plotIndex}.type = 'scatter3d';
-
- %-flag to manage 3d plots-%
- obj.PlotOptions.is3d = true;
- end
-end
+ %-scatter y-%
+ obj.data{plotIndex}.y = y(1);
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-scatter name-%
-obj.data{plotIndex}.name = plotData.Tag;
+ %-For 3D plots-%
+ obj.PlotOptions.is3d = false; % by default
+
+ nSet = unique(z);
+ if numel(nSet)>1
+ if any(z)
+ %-scatter z-%
+ obj.data{plotIndex}.z = z(1);
+
+ %-overwrite type-%
+ obj.data{plotIndex}.type = 'scatter3d';
+
+ %-flag to manage 3d plots-%
+ obj.PlotOptions.is3d = true;
+ end
+ end
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-scatter mode-%
-if ~strcmpi('none', plotData.Marker) ...
- && ~strcmpi('none', plotData.LineStyle)
- mode = 'lines+markers';
-elseif ~strcmpi('none', plotData.Marker)
- mode = 'markers';
-elseif ~strcmpi('none', plotData.LineStyle)
- mode = 'lines';
-else
- mode = 'none';
-end
+ %-scatter name-%
+ obj.data{plotIndex}.name = plotData.Tag;
-obj.data{plotIndex}.mode = mode;
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-scatter mode-%
+ if ~strcmpi('none', plotData.Marker) ...
+ && ~strcmpi('none', plotData.LineStyle)
+ mode = 'lines+markers';
+ elseif ~strcmpi('none', plotData.Marker)
+ mode = 'markers';
+ elseif ~strcmpi('none', plotData.LineStyle)
+ mode = 'lines';
+ else
+ mode = 'none';
+ end
-%-scatter line-%
-obj.data{plotIndex}.line = extractLineLine(plotData);
+ obj.data{plotIndex}.mode = mode;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-scatter marker-%
-obj.data{plotIndex}.marker = extractLineMarker(plotData);
+ %-scatter line-%
+ obj.data{plotIndex}.line = extractLineLine(plotData);
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-scatter showlegend-%
-leg = plotData.Annotation;
-legInfo = leg.LegendInformation;
+ %-scatter marker-%
+ obj.data{plotIndex}.marker = extractLineMarker(plotData);
-switch legInfo.IconDisplayStyle
- case 'on'
- showleg = true;
- case 'off'
- showleg = false;
-end
+ %---------------------------------------------------------------------%
-obj.data{plotIndex}.showlegend = showleg;
+ %-scatter showlegend-%
+ leg = plotData.Annotation;
+ legInfo = leg.LegendInformation;
-%-------------------------------------------------------------------------%
+ switch legInfo.IconDisplayStyle
+ case 'on'
+ showleg = true;
+ case 'off'
+ showleg = false;
+ end
-%-SCENE CONFIGUTATION-% for 3D animations, like comet3
+ obj.data{plotIndex}.showlegend = showleg;
-%-------------------------------------------------------------------------%
-if obj.PlotOptions.is3d
+ %---------------------------------------------------------------------%
- %-aspect ratio-%
- asr = obj.PlotOptions.AspectRatio;
+ %-SCENE CONFIGUTATION-% for 3D animations, like comet3
- if ~isempty(asr)
- if ischar(asr)
- scene.aspectmode = asr;
- elseif isvector(ar) && length(asr) == 3
- xar = asr(1);
- yar = asr(2);
- zar = asr(3);
+ %---------------------------------------------------------------------%
+ if obj.PlotOptions.is3d
+
+ %-aspect ratio-%
+ asr = obj.PlotOptions.AspectRatio;
+
+ if ~isempty(asr)
+ if ischar(asr)
+ scene.aspectmode = asr;
+ elseif isvector(ar) && length(asr) == 3
+ xar = asr(1);
+ yar = asr(2);
+ zar = asr(3);
+ end
+ else
+ %-define as default-%
+ xar = max(x(:));
+ yar = max(y(:));
+ xyar = max([xar, yar]);
+ zar = 0.75*xyar;
end
- else
-
- %-define as default-%
- xar = max(x(:));
- yar = max(y(:));
- xyar = max([xar, yar]);
- zar = 0.75*xyar;
- end
- scene.aspectratio.x = 1.1*xyar;
- scene.aspectratio.y = 1.0*xyar;
- scene.aspectratio.z = zar;
+ scene.aspectratio.x = 1.1*xyar;
+ scene.aspectratio.y = 1.0*xyar;
+ scene.aspectratio.z = zar;
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
- %-camera eye-%
- ey = obj.PlotOptions.CameraEye;
+ %-camera eye-%
+ ey = obj.PlotOptions.CameraEye;
- if ~isempty(ey)
- if isvector(ey) && length(ey) == 3
- scene.camera.eye.x = ey(1);
- scene.camera.eye.y = ey(2);
- scene.camera.eye.z = ey(3);
+ if ~isempty(ey)
+ if isvector(ey) && length(ey) == 3
+ scene.camera.eye.x = ey(1);
+ scene.camera.eye.y = ey(2);
+ scene.camera.eye.z = ey(3);
+ end
+ else
+ %-define as default-%
+ xey = - xyar; if xey>0, xfac = -0.0; else, xfac = 0.0; end
+ yey = - xyar; if yey>0, yfac = -0.3; else, yfac = 0.3; end
+ if zar>0, zfac = -0.1; else, zfac = 0.1; end
+
+ scene.camera.eye.x = xey + xfac*xey;
+ scene.camera.eye.y = yey + yfac*yey;
+ scene.camera.eye.z = zar + zfac*zar;
end
- else
- %-define as default-%
- xey = - xyar; if xey>0, xfac = -0.0; else, xfac = 0.0; end
- yey = - xyar; if yey>0, yfac = -0.3; else, yfac = 0.3; end
- if zar>0, zfac = -0.1; else, zfac = 0.1; end
+ %-----------------------------------------------------------------%
- scene.camera.eye.x = xey + xfac*xey;
- scene.camera.eye.y = yey + yfac*yey;
- scene.camera.eye.z = zar + zfac*zar;
- end
-
- %-------------------------------------------------------------------------%
+ %-scene axis configuration-%
- %-scene axis configuration-%
+ scene.xaxis.range = axisData.XLim;
+ scene.yaxis.range = axisData.YLim;
+ scene.zaxis.range = axisData.ZLim;
- scene.xaxis.range = axisData.XLim;
- scene.yaxis.range = axisData.YLim;
- scene.zaxis.range = axisData.ZLim;
+ scene.xaxis.tickvals = axisData.XTick;
+ scene.xaxis.ticktext = axisData.XTickLabel;
- scene.xaxis.tickvals = axisData.XTick;
- scene.xaxis.ticktext = axisData.XTickLabel;
+ scene.yaxis.tickvals = axisData.YTick;
+ scene.yaxis.ticktext = axisData.YTickLabel;
- scene.yaxis.tickvals = axisData.YTick;
- scene.yaxis.ticktext = axisData.YTickLabel;
+ scene.zaxis.tickvals = axisData.ZTick;
+ scene.zaxis.ticktext = axisData.ZTickLabel;
- scene.zaxis.tickvals = axisData.ZTick;
- scene.zaxis.ticktext = axisData.ZTickLabel;
+ scene.xaxis.zeroline = false;
+ scene.yaxis.zeroline = false;
+ scene.zaxis.zeroline = false;
- scene.xaxis.zeroline = false;
- scene.yaxis.zeroline = false;
- scene.zaxis.zeroline = false;
+ scene.xaxis.showgrid = strcmpi(axisData.XGrid,'on');
+ scene.yaxis.showgrid = strcmpi(axisData.YGrid,'on');
+ scene.zaxis.showgrid = strcmpi(axisData.ZGrid,'on');
- scene.xaxis.showgrid = strcmpi(axisData.XGrid,'on');
- scene.yaxis.showgrid = strcmpi(axisData.YGrid,'on');
- scene.zaxis.showgrid = strcmpi(axisData.ZGrid,'on');
+ scene.xaxis.showline = true;
+ scene.yaxis.showline = true;
+ scene.zaxis.showline = true;
- scene.xaxis.showline = true;
- scene.yaxis.showline = true;
- scene.zaxis.showline = true;
+ scene.xaxis.tickcolor = 'rgba(0,0,0,1)';
+ scene.yaxis.tickcolor = 'rgba(0,0,0,1)';
+ scene.zaxis.tickcolor = 'rgba(0,0,0,1)';
- scene.xaxis.tickcolor = 'rgba(0,0,0,1)';
- scene.yaxis.tickcolor = 'rgba(0,0,0,1)';
- scene.zaxis.tickcolor = 'rgba(0,0,0,1)';
+ scene.xaxis.ticklabelposition = 'outside';
+ scene.yaxis.ticklabelposition = 'outside';
+ scene.zaxis.ticklabelposition = 'outside';
- scene.xaxis.ticklabelposition = 'outside';
- scene.yaxis.ticklabelposition = 'outside';
- scene.zaxis.ticklabelposition = 'outside';
+ scene.xaxis.title = axisData.XLabel.String;
+ scene.yaxis.title = axisData.YLabel.String;
+ scene.zaxis.title = axisData.ZLabel.String;
- scene.xaxis.title = axisData.XLabel.String;
- scene.yaxis.title = axisData.YLabel.String;
- scene.zaxis.title = axisData.ZLabel.String;
+ scene.xaxis.tickfont.size = axisData.FontSize;
+ scene.yaxis.tickfont.size = axisData.FontSize;
+ scene.zaxis.tickfont.size = axisData.FontSize;
- scene.xaxis.tickfont.size = axisData.FontSize;
- scene.yaxis.tickfont.size = axisData.FontSize;
- scene.zaxis.tickfont.size = axisData.FontSize;
+ scene.xaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
+ scene.yaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
+ scene.zaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
- scene.xaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
- scene.yaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
- scene.zaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
+ %-----------------------------------------------------------------%
- %-------------------------------------------------------------------------%
-
- %-SET SCENE TO LAYOUT-%
- obj.layout = setfield(obj.layout, sprintf('scene%d', xsource), scene);
-end
+ %-SET SCENE TO LAYOUT-%
+ obj.layout = setfield(obj.layout, sprintf('scene%d', xsource), scene);
+ end
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-Add a temporary tag-%
-obj.layout.isAnimation = true;
+ %-Add a temporary tag-%
+ obj.layout.isAnimation = true;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-Create Frames-%
-frameData = obj.data{plotIndex};
+ %-Create Frames-%
+ frameData = obj.data{plotIndex};
-switch(plotData.Tag)
- case 'head'
- for i = 1:length(x)
- frameData.x=[x(i) x(i)];
- frameData.y=[y(i) y(i)];
- if obj.PlotOptions.is3d
- frameData.z=[z(i) z(i)];
- end
- obj.frames{i}.data{plotIndex} = frameData;
- obj.frames{i}.name=['f',num2str(i)];
- end
- case 'body'
- for i = 1:length(x)
- sIdx = i-animObj.MaximumNumPoints;
- if sIdx < 0
- sIdx=0;
- end
- frameData.x=x(sIdx+1:i);
- frameData.y=y(sIdx+1:i);
- if obj.PlotOptions.is3d
- frameData.z=z(sIdx+1:i);
- end
- if i==length(x)
- frameData.x=nan;
- frameData.y=nan;
+ switch(plotData.Tag)
+ case 'head'
+ for i = 1:length(x)
+ frameData.x=[x(i) x(i)];
+ frameData.y=[y(i) y(i)];
if obj.PlotOptions.is3d
- frameData.z=nan;
+ frameData.z=[z(i) z(i)];
end
+ obj.frames{i}.data{plotIndex} = frameData;
+ obj.frames{i}.name=['f',num2str(i)];
end
- obj.frames{i}.data{plotIndex} = frameData;
- end
- case 'tail'
- for i = 1:length(x)
- frameData.x=x(1:i);
- frameData.y=y(1:i);
- if obj.PlotOptions.is3d
- frameData.z=z(1:i);
- end
- if i < body.MaximumNumPoints
- rIdx = i;
- else
- rIdx = body.MaximumNumPoints;
+ case 'body'
+ for i = 1:length(x)
+ sIdx = i-animObj.MaximumNumPoints;
+ if sIdx < 0
+ sIdx=0;
+ end
+ frameData.x=x(sIdx+1:i);
+ frameData.y=y(sIdx+1:i);
+ if obj.PlotOptions.is3d
+ frameData.z=z(sIdx+1:i);
+ end
+ if i==length(x)
+ frameData.x=nan;
+ frameData.y=nan;
+ if obj.PlotOptions.is3d
+ frameData.z=nan;
+ end
+ end
+ obj.frames{i}.data{plotIndex} = frameData;
end
- if i ~= length(x)
- val = nan(rIdx,1);
- frameData.x(end-rIdx+1:end)=val;
- frameData.y(end-rIdx+1:end)=val;
+ case 'tail'
+ for i = 1:length(x)
+ frameData.x=x(1:i);
+ frameData.y=y(1:i);
if obj.PlotOptions.is3d
- frameData.z(end-rIdx+1:end)=val;
+ frameData.z=z(1:i);
+ end
+ if i < body.MaximumNumPoints
+ rIdx = i;
+ else
+ rIdx = body.MaximumNumPoints;
end
+ if i ~= length(x)
+ val = nan(rIdx,1);
+ frameData.x(end-rIdx+1:end)=val;
+ frameData.y(end-rIdx+1:end)=val;
+ if obj.PlotOptions.is3d
+ frameData.z(end-rIdx+1:end)=val;
+ end
+ end
+ obj.frames{i}.data{plotIndex} = frameData;
end
- obj.frames{i}.data{plotIndex} = frameData;
- end
-end
-
+ end
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateConeplot.m b/plotly/plotlyfig_aux/handlegraphics/updateConeplot.m
index 84e48661..376b6768 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateConeplot.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateConeplot.m
@@ -1,166 +1,162 @@
function obj = updateConeplot(obj, coneIndex)
+ %-AXIS INDEX-%
+ axIndex = obj.getAxisIndex(obj.State.Plot(coneIndex).AssociatedAxis);
-%-AXIS INDEX-%
-axIndex = obj.getAxisIndex(obj.State.Plot(coneIndex).AssociatedAxis);
+ %-CONE DATA STRUCTURE- %
+ cone_data = obj.State.Plot(coneIndex).Handle;
-%-CONE DATA STRUCTURE- %
-cone_data = obj.State.Plot(coneIndex).Handle;
+ %-CHECK FOR MULTIPLE AXES-%
+ [xsource, ysource] = findSourceAxis(obj,axIndex);
-%-CHECK FOR MULTIPLE AXES-%
-[xsource, ysource] = findSourceAxis(obj,axIndex);
+ %-SCENE DATA-%
+ scene = obj.layout.("scene" + xsource);
-%-SCENE DATA-%
-scene = obj.layout.("scene" + xsource);
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-cone type-%
+ obj.data{coneIndex}.type = 'cone';
-%-cone type-%
-obj.data{coneIndex}.type = 'cone';
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-get plot data-%
+ xdata = cone_data.XData;
+ ydata = cone_data.YData;
+ zdata = cone_data.ZData;
-%-get plot data-%
-xdata = cone_data.XData;
-ydata = cone_data.YData;
-zdata = cone_data.ZData;
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-reformat data-%
+ nfaces = size(xdata, 2);
+ ref = xdata(end,1);
-%-reformat data-%
-nfaces = size(xdata, 2);
-ref = xdata(end,1);
-
-for n=1:nfaces
- if ref ~= xdata(end, n)
- step1 = n-1;
- break
+ for n=1:nfaces
+ if ref ~= xdata(end, n)
+ step1 = n-1;
+ break
+ end
end
-end
-ref = xdata(1,step1);
+ ref = xdata(1,step1);
-for n=step1:nfaces
- if ref ~= xdata(1, n)
- step2 = n-1;
- break
+ for n=step1:nfaces
+ if ref ~= xdata(1, n)
+ step2 = n-1;
+ break
+ end
end
-end
-
-x = []; y = []; z = [];
-u = []; v = []; w = [];
-
-for c = 1:step2:nfaces
- xhead = xdata(end,c);
- yhead = ydata(end,c);
- zhead = zdata(end,c);
-
- xtail = mean(xdata(2,c:c+step1-1));
- ytail = mean(ydata(2,c:c+step1-1));
- ztail = mean(zdata(2,c:c+step1-1));
-
- u = [u; xhead - xtail];
- v = [v; yhead - ytail];
- w = [w; zhead - ztail];
-
- % x = [x; xtail];
- % y = [y; ytail];
- % z = [z; ztail];
-
- x = [x; 0.5*(xtail+xhead)];
- y = [y; 0.5*(ytail+yhead)];
- z = [z; 0.5*(ztail+zhead)];
-end
-
-%-------------------------------------------------------------------------%
-%-set plot data-%
-obj.data{coneIndex}.x = x;
-obj.data{coneIndex}.y = y;
-obj.data{coneIndex}.z = z;
-obj.data{coneIndex}.u = u;
-obj.data{coneIndex}.v = v;
-obj.data{coneIndex}.w = w;
+ x = []; y = []; z = [];
+ u = []; v = []; w = [];
-%-------------------------------------------------------------------------%
+ for c = 1:step2:nfaces
+ xhead = xdata(end,c);
+ yhead = ydata(end,c);
+ zhead = zdata(end,c);
-%-set cone color-%
-obj.data{coneIndex}.colorscale{1} = {0, sprintf('rgb(%f,%f,%f)', cone_data.EdgeColor)};
-obj.data{coneIndex}.colorscale{2} = {1, sprintf('rgb(%f,%f,%f)', cone_data.EdgeColor)};
+ xtail = mean(xdata(2,c:c+step1-1));
+ ytail = mean(ydata(2,c:c+step1-1));
+ ztail = mean(zdata(2,c:c+step1-1));
-%-------------------------------------------------------------------------%
+ u = [u; xhead - xtail];
+ v = [v; yhead - ytail];
+ w = [w; zhead - ztail];
-%-plot setting-%
-obj.data{coneIndex}.showscale = false;
-obj.data{coneIndex}.sizemode = 'scaled';
-obj.data{coneIndex}.sizeref = 1.5;
+ % x = [x; xtail];
+ % y = [y; ytail];
+ % z = [z; ztail];
-%-------------------------------------------------------------------------%
-
-%-scene axis-%
-scene.xaxis.tickvals = cone_data.Parent.XTick;
-scene.xaxis.ticktext = cone_data.Parent.XTickLabel;
-scene.yaxis.tickvals = cone_data.Parent.YTick;
-scene.yaxis.ticktext = cone_data.Parent.YTickLabel;
-scene.zaxis.range = cone_data.Parent.ZLim;
-scene.zaxis.nticks = 10;
-
-%---------------------------------------------------------------------%
-
-%-aspect ratio-%
-ar = obj.PlotOptions.AspectRatio;
-
-if ~isempty(ar)
- if ischar(ar)
- scene.aspectmode = ar;
- elseif isvector(ar) && length(ar) == 3
- xar = ar(1);
- yar = ar(2);
- zar = ar(3);
+ x = [x; 0.5*(xtail+xhead)];
+ y = [y; 0.5*(ytail+yhead)];
+ z = [z; 0.5*(ztail+zhead)];
end
-else
-
- %-define as default-%
- xar = max(xdata(:));
- yar = max(ydata(:));
- xyar = min([xar, yar]);
- xar = xyar;
- yar = xyar;
- zar = 0.7*xyar;
-end
-
-scene.aspectratio.x = xar;
-scene.aspectratio.y = yar;
-scene.aspectratio.z = zar;
-%---------------------------------------------------------------------%
-
-%-camera eye-%
-ey = obj.PlotOptions.CameraEye;
-
-if ~isempty(ey)
- if isvector(ey) && length(ey) == 3
- scene.camera.eye.x = ey(1);
- scene.camera.eye.y = ey(2);
- scene.camera.eye.z = ey(3);
+ %---------------------------------------------------------------------%
+
+ %-set plot data-%
+ obj.data{coneIndex}.x = x;
+ obj.data{coneIndex}.y = y;
+ obj.data{coneIndex}.z = z;
+ obj.data{coneIndex}.u = u;
+ obj.data{coneIndex}.v = v;
+ obj.data{coneIndex}.w = w;
+
+ %---------------------------------------------------------------------%
+
+ %-set cone color-%
+ obj.data{coneIndex}.colorscale{1} = ...
+ {0, sprintf('rgb(%f,%f,%f)', cone_data.EdgeColor)};
+ obj.data{coneIndex}.colorscale{2} = ...
+ {1, sprintf('rgb(%f,%f,%f)', cone_data.EdgeColor)};
+
+ %---------------------------------------------------------------------%
+
+ %-plot setting-%
+ obj.data{coneIndex}.showscale = false;
+ obj.data{coneIndex}.sizemode = 'scaled';
+ obj.data{coneIndex}.sizeref = 1.5;
+
+ %---------------------------------------------------------------------%
+
+ %-scene axis-%
+ scene.xaxis.tickvals = cone_data.Parent.XTick;
+ scene.xaxis.ticktext = cone_data.Parent.XTickLabel;
+ scene.yaxis.tickvals = cone_data.Parent.YTick;
+ scene.yaxis.ticktext = cone_data.Parent.YTickLabel;
+ scene.zaxis.range = cone_data.Parent.ZLim;
+ scene.zaxis.nticks = 10;
+
+ %---------------------------------------------------------------------%
+
+ %-aspect ratio-%
+ ar = obj.PlotOptions.AspectRatio;
+
+ if ~isempty(ar)
+ if ischar(ar)
+ scene.aspectmode = ar;
+ elseif isvector(ar) && length(ar) == 3
+ xar = ar(1);
+ yar = ar(2);
+ zar = ar(3);
+ end
+ else
+ %-define as default-%
+ xar = max(xdata(:));
+ yar = max(ydata(:));
+ xyar = min([xar, yar]);
+ xar = xyar;
+ yar = xyar;
+ zar = 0.7*xyar;
end
-else
-
- %-define as default-%
- xey = - xar; if xey>0 xfac = -0.2; else xfac = 0.2; end
- yey = - yar; if yey>0 yfac = -0.2; else yfac = 0.2; end
- if zar>0 zfac = 0.2; else zfac = -0.2; end
-
- scene.camera.eye.x = xey + xfac*xey;
- scene.camera.eye.y = yey + yfac*yey;
- scene.camera.eye.z = zar + zfac*zar;
-end
-%---------------------------------------------------------------------%
-
-%-set scene to layout-%
-obj.layout = setfield(obj.layout,['scene' num2str(xsource)], scene);
-obj.data{coneIndex}.scene = ['scene' num2str(xsource)];
+ scene.aspectratio.x = xar;
+ scene.aspectratio.y = yar;
+ scene.aspectratio.z = zar;
+
+ %---------------------------------------------------------------------%
+
+ %-camera eye-%
+ ey = obj.PlotOptions.CameraEye;
+
+ if ~isempty(ey)
+ if isvector(ey) && length(ey) == 3
+ scene.camera.eye.x = ey(1);
+ scene.camera.eye.y = ey(2);
+ scene.camera.eye.z = ey(3);
+ end
+ else
+ %-define as default-%
+ xey = - xar; if xey>0 xfac = -0.2; else xfac = 0.2; end
+ yey = - yar; if yey>0 yfac = -0.2; else yfac = 0.2; end
+ if zar>0 zfac = 0.2; else zfac = -0.2; end
+
+ scene.camera.eye.x = xey + xfac*xey;
+ scene.camera.eye.y = yey + yfac*yey;
+ scene.camera.eye.z = zar + zfac*zar;
+ end
-%---------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
+ %-set scene to layout-%
+ obj.layout = setfield(obj.layout,['scene' num2str(xsource)], scene);
+ obj.data{coneIndex}.scene = ['scene' num2str(xsource)];
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateContour3.m b/plotly/plotlyfig_aux/handlegraphics/updateContour3.m
index 69420ae7..910b0b4d 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateContour3.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateContour3.m
@@ -1,183 +1,173 @@
function obj = updateContour3(obj,contourIndex)
+ %-FIGURE DATA STRUCTURE-%
+ figure_data = obj.State.Figure.Handle;
+ %-AXIS INDEX-%
+ axIndex = obj.getAxisIndex(obj.State.Plot(contourIndex).AssociatedAxis);
-%-FIGURE DATA STRUCTURE-%
-figure_data = obj.State.Figure.Handle;
+ %-AXIS DATA STRUCTURE-%
+ axis_data = obj.State.Plot(contourIndex).AssociatedAxis;
-%-AXIS INDEX-%
-axIndex = obj.getAxisIndex(obj.State.Plot(contourIndex).AssociatedAxis);
+ %-PLOT DATA STRUCTURE- %
+ contour_data = obj.State.Plot(contourIndex).Handle;
-%-AXIS DATA STRUCTURE-%
-axis_data = obj.State.Plot(contourIndex).AssociatedAxis;
+ %-CHECK FOR MULTIPLE AXES-%
+ [xsource, ysource] = findSourceAxis(obj,axIndex);
-%-PLOT DATA STRUCTURE- %
-contour_data = obj.State.Plot(contourIndex).Handle;
+ %-AXIS DATA-%
+ xaxis = obj.layout.("xaxis" + xsource);
+ yaxis = obj.layout.("yaxis" + ysource);
-%-CHECK FOR MULTIPLE AXES-%
-[xsource, ysource] = findSourceAxis(obj,axIndex);
+ %---------------------------------------------------------------------%
-%-AXIS DATA-%
-xaxis = obj.layout.("xaxis" + xsource);
-yaxis = obj.layout.("yaxis" + ysource);
+ %-contour xaxis and yaxis-%
+ obj.data{contourIndex}.xaxis = ['x' num2str(xsource)];
+ obj.data{contourIndex}.yaxis = ['y' num2str(ysource)];
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-contour xaxis-%
-obj.data{contourIndex}.xaxis = ['x' num2str(xsource)];
+ %-contour name-%
+ obj.data{contourIndex}.name = contour_data.DisplayName;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-contour yaxis-%
-obj.data{contourIndex}.yaxis = ['y' num2str(ysource)];
+ %-setting the plot-%
+ xdata = contour_data.XData;
+ ydata = contour_data.YData;
+ zdata = contour_data.ZData;
+
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-contour type-%
+ obj.data{contourIndex}.type = 'surface';
-%-contour name-%
-obj.data{contourIndex}.name = contour_data.DisplayName;
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
-
-%-setting the plot-%
-xdata = contour_data.XData;
-ydata = contour_data.YData;
-zdata = contour_data.ZData;
-
-%---------------------------------------------------------------------%
-
-%-contour type-%
-obj.data{contourIndex}.type = 'surface';
-
-%---------------------------------------------------------------------%
-
-%-contour x and y data
-if isvector(xdata)
- [xdata, ydata] = meshgrid(xdata, ydata);
-end
-obj.data{contourIndex}.x = xdata;
-obj.data{contourIndex}.y = ydata;
-
-%---------------------------------------------------------------------%
-
-%-contour z data-%
-obj.data{contourIndex}.z = zdata;
-
-%---------------------------------------------------------------------%
-
-%-setting for contour lines z-direction-%
-if length(contour_data.LevelList) > 1
- zstart = contour_data.TextList(1);
- zend = contour_data.TextList(end);
- zsize = mean(diff(contour_data.TextList));
-else
- zstart = contour_data.TextList(1) - 1e-3;
- zend = contour_data.TextList(end) + 1e-3;
- zsize = 2e-3;
-end
-
-obj.data{contourIndex}.contours.z.start = zstart;
-obj.data{contourIndex}.contours.z.end = zend;
-obj.data{contourIndex}.contours.z.size = zsize;
-obj.data{contourIndex}.contours.z.show = true;
-obj.data{contourIndex}.contours.z.usecolormap = true;
-obj.data{contourIndex}.contours.z.width = 2*contour_data.LineWidth;
-obj.data{contourIndex}.hidesurface = true;
-
-%---------------------------------------------------------------------%
-
-%-colorscale-%
-colormap = figure_data.Colormap;
+ %-contour x and y data
+ if isvector(xdata)
+ [xdata, ydata] = meshgrid(xdata, ydata);
+ end
+ obj.data{contourIndex}.x = xdata;
+ obj.data{contourIndex}.y = ydata;
-for c = 1:size((colormap),1)
- col = 255*(colormap(c,:));
- obj.data{contourIndex}.colorscale{c} = {(c-1)/(size(colormap,1)-1), ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')']};
-end
+ %---------------------------------------------------------------------%
-%---------------------------------------------------------------------%
+ %-contour z data-%
+ obj.data{contourIndex}.z = zdata;
-%-aspect ratio-%
-ar = obj.PlotOptions.AspectRatio;
+ %---------------------------------------------------------------------%
-if ~isempty(ar)
- if ischar(ar)
- obj.layout.scene.aspectmode = ar;
- elseif isvector(ar) && length(ar) == 3
- xar = ar(1);
- yar = ar(2);
- zar = ar(3);
+ %-setting for contour lines z-direction-%
+ if length(contour_data.LevelList) > 1
+ zstart = contour_data.TextList(1);
+ zend = contour_data.TextList(end);
+ zsize = mean(diff(contour_data.TextList));
+ else
+ zstart = contour_data.TextList(1) - 1e-3;
+ zend = contour_data.TextList(end) + 1e-3;
+ zsize = 2e-3;
end
-else
-
- %-define as default-%
- xar = max(xdata(:));
- yar = max(ydata(:));
- zar = 0.7*max([xar, yar]);
-end
-obj.layout.scene.aspectratio.x = xar;
-obj.layout.scene.aspectratio.y = yar;
-obj.layout.scene.aspectratio.z = zar;
+ obj.data{contourIndex}.contours.z.start = zstart;
+ obj.data{contourIndex}.contours.z.end = zend;
+ obj.data{contourIndex}.contours.z.size = zsize;
+ obj.data{contourIndex}.contours.z.show = true;
+ obj.data{contourIndex}.contours.z.usecolormap = true;
+ obj.data{contourIndex}.contours.z.width = 2*contour_data.LineWidth;
+ obj.data{contourIndex}.hidesurface = true;
-%---------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-camera eye-%
-ey = obj.PlotOptions.CameraEye;
+ %-colorscale-%
+ colormap = figure_data.Colormap;
-if ~isempty(ey)
- if isvector(ey) && length(ey) == 3
- obj.layout.scene.camera.eye.x = ey(1);
- obj.layout.scene.camera.eye.y = ey(2);
- obj.layout.scene.camera.eye.z = ey(3);
+ for c = 1:size((colormap),1)
+ col = 255*(colormap(c,:));
+ obj.data{contourIndex}.colorscale{c} = ...
+ {(c-1)/(size(colormap,1)-1), sprintf("rgb(%f,%f,%f)", col)};
end
-else
-
- %-define as default-%
- xey = - xar; if xey>0 xfac = -0.2; else xfac = 0.2; end
- yey = - yar; if yey>0 yfac = -0.2; else yfac = 0.2; end
- if zar>0 zfac = 0.2; else zfac = -0.2; end
-
- obj.layout.scene.camera.eye.x = xey + xfac*xey;
- obj.layout.scene.camera.eye.y = yey + yfac*yey;
- obj.layout.scene.camera.eye.z = zar + zfac*zar;
-end
-%---------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
+
+ %-aspect ratio-%
+ ar = obj.PlotOptions.AspectRatio;
+
+ if ~isempty(ar)
+ if ischar(ar)
+ obj.layout.scene.aspectmode = ar;
+ elseif isvector(ar) && length(ar) == 3
+ xar = ar(1);
+ yar = ar(2);
+ zar = ar(3);
+ end
+ else
+ %-define as default-%
+ xar = max(xdata(:));
+ yar = max(ydata(:));
+ zar = 0.7*max([xar, yar]);
+ end
-%-zerolines hidded-%
-obj.layout.scene.xaxis.zeroline = false;
-obj.layout.scene.yaxis.zeroline = false;
-obj.layout.scene.zaxis.zeroline = false;
+ obj.layout.scene.aspectratio.x = xar;
+ obj.layout.scene.aspectratio.y = yar;
+ obj.layout.scene.aspectratio.z = zar;
+
+ %---------------------------------------------------------------------%
+
+ %-camera eye-%
+ ey = obj.PlotOptions.CameraEye;
+
+ if ~isempty(ey)
+ if isvector(ey) && length(ey) == 3
+ obj.layout.scene.camera.eye.x = ey(1);
+ obj.layout.scene.camera.eye.y = ey(2);
+ obj.layout.scene.camera.eye.z = ey(3);
+ end
+ else
+ %-define as default-%
+ xey = - xar; if xey>0 xfac = -0.2; else xfac = 0.2; end
+ yey = - yar; if yey>0 yfac = -0.2; else yfac = 0.2; end
+ if zar>0 zfac = 0.2; else zfac = -0.2; end
+
+ obj.layout.scene.camera.eye.x = xey + xfac*xey;
+ obj.layout.scene.camera.eye.y = yey + yfac*yey;
+ obj.layout.scene.camera.eye.z = zar + zfac*zar;
+ end
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-contour visible-%
-obj.data{contourIndex}.visible = strcmp(contour_data.Visible,'on');
+ %-zerolines hidded-%
+ obj.layout.scene.xaxis.zeroline = false;
+ obj.layout.scene.yaxis.zeroline = false;
+ obj.layout.scene.zaxis.zeroline = false;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-contour showscale-%
-obj.data{contourIndex}.showscale = false;
+ %-contour visible-%
+ obj.data{contourIndex}.visible = strcmp(contour_data.Visible, 'on');
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-contour reverse scale-%
-obj.data{contourIndex}.reversescale = false;
+ %-contour showscale-%
+ obj.data{contourIndex}.showscale = false;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-contour showlegend-%
+ %-contour reverse scale-%
+ obj.data{contourIndex}.reversescale = false;
-leg = contour_data.Annotation;
-legInfo = leg.LegendInformation;
+ %---------------------------------------------------------------------%
-switch legInfo.IconDisplayStyle
- case 'on'
- showleg = true;
- case 'off'
- showleg = false;
-end
+ %-contour showlegend-%
-obj.data{contourIndex}.showlegend = showleg;
+ leg = contour_data.Annotation;
+ legInfo = leg.LegendInformation;
-%-------------------------------------------------------------------------%
+ switch legInfo.IconDisplayStyle
+ case 'on'
+ showleg = true;
+ case 'off'
+ showleg = false;
+ end
+ obj.data{contourIndex}.showlegend = showleg;
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateContourProjection.m b/plotly/plotlyfig_aux/handlegraphics/updateContourProjection.m
index f3842cce..7a5bf183 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateContourProjection.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateContourProjection.m
@@ -1,160 +1,151 @@
function obj = updateContourProjection(obj,contourIndex)
+ %-FIGURE DATA STRUCTURE-%
+ figure_data = obj.State.Figure.Handle;
-%-FIGURE DATA STRUCTURE-%
-figure_data = obj.State.Figure.Handle;
+ %-AXIS INDEX-%
+ axIndex = obj.getAxisIndex(obj.State.Plot(contourIndex).AssociatedAxis);
-%-AXIS INDEX-%
-axIndex = obj.getAxisIndex(obj.State.Plot(contourIndex).AssociatedAxis);
+ %-AXIS DATA STRUCTURE-%
+ axis_data = obj.State.Plot(contourIndex).AssociatedAxis;
-%-AXIS DATA STRUCTURE-%
-axis_data = obj.State.Plot(contourIndex).AssociatedAxis;
+ %-PLOT DATA STRUCTURE- %
+ contour_data = obj.State.Plot(contourIndex).Handle;
-%-PLOT DATA STRUCTURE- %
-contour_data = obj.State.Plot(contourIndex).Handle;
+ %-CHECK FOR MULTIPLE AXES-%
+ [xsource, ysource] = findSourceAxis(obj,axIndex);
-%-CHECK FOR MULTIPLE AXES-%
-[xsource, ysource] = findSourceAxis(obj,axIndex);
+ %-AXIS DATA-%
+ xaxis = obj.layout.("xaxis" + xsource);
+ yaxis = obj.layout.("yaxis" + ysource);
-%-AXIS DATA-%
-xaxis = obj.layout.("xaxis" + xsource);
-yaxis = obj.layout.("yaxis" + ysource);
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-contour xaxis and yaxis-%
+ obj.data{contourIndex}.xaxis = ['x' num2str(xsource)];
+ obj.data{contourIndex}.yaxis = ['y' num2str(ysource)];
-%-contour xaxis-%
-obj.data{contourIndex}.xaxis = ['x' num2str(xsource)];
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-contour name-%
+ obj.data{contourIndex}.name = contour_data.DisplayName;
-%-contour yaxis-%
-obj.data{contourIndex}.yaxis = ['y' num2str(ysource)];
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-setting the plot-%
+ xdata = contour_data.XData;
+ ydata = contour_data.YData;
+ zdata = contour_data.ZData;
+
+ %-contour type-%
+ obj.data{contourIndex}.type = 'surface';
-%-contour name-%
-obj.data{contourIndex}.name = contour_data.DisplayName;
+ %-contour x and y data
+ obj.data{contourIndex}.x = xdata;
+ obj.data{contourIndex}.y = ydata;
-%-------------------------------------------------------------------------%
+ %-contour z data-%
+ obj.data{contourIndex}.z = zdata;%-2*ones(size(zdata));
-%-setting the plot-%
-xdata = contour_data.XData;
-ydata = contour_data.YData;
-zdata = contour_data.ZData;
-
-%-contour type-%
-obj.data{contourIndex}.type = 'surface';
+ %-setting for contour lines z-direction-%
+ obj.data{contourIndex}.contours.z.start = contour_data.LevelList(1);
+ obj.data{contourIndex}.contours.z.end = contour_data.LevelList(end);
+ obj.data{contourIndex}.contours.z.size = contour_data.LevelStep;
+ obj.data{contourIndex}.contours.z.show = true;
+ obj.data{contourIndex}.contours.z.usecolormap = true;
+ obj.data{contourIndex}.hidesurface = true;
+ obj.data{contourIndex}.surfacecolor = zdata;
-%-contour x and y data
-obj.data{contourIndex}.x = xdata;
-obj.data{contourIndex}.y = ydata;
+ obj.data{contourIndex}.contours.z.project.x = true;
+ obj.data{contourIndex}.contours.z.project.y = true;
+ obj.data{contourIndex}.contours.z.project.z = true;
-%-contour z data-%
-obj.data{contourIndex}.z = zdata;%-2*ones(size(zdata));
+ %---------------------------------------------------------------------%
-%-setting for contour lines z-direction-%
-obj.data{contourIndex}.contours.z.start = contour_data.LevelList(1);
-obj.data{contourIndex}.contours.z.end = contour_data.LevelList(end);
-obj.data{contourIndex}.contours.z.size = contour_data.LevelStep;
-obj.data{contourIndex}.contours.z.show = true;
-obj.data{contourIndex}.contours.z.usecolormap = true;
-obj.data{contourIndex}.hidesurface = true;
-obj.data{contourIndex}.surfacecolor = zdata;
+ %-contour visible-%
-obj.data{contourIndex}.contours.z.project.x = true;
-obj.data{contourIndex}.contours.z.project.y = true;
-obj.data{contourIndex}.contours.z.project.z = true;
+ obj.data{contourIndex}.visible = strcmp(contour_data.Visible,'on');
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-contour visible-%
+ %-contour showscale-%
+ obj.data{contourIndex}.showscale = false;
-obj.data{contourIndex}.visible = strcmp(contour_data.Visible,'on');
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-colorscale (ASSUMES PATCH CDATAMAP IS 'SCALED')-%
+ colormap = figure_data.Colormap;
-%-contour showscale-%
-obj.data{contourIndex}.showscale = false;
-
-%-------------------------------------------------------------------------%
-
-%-colorscale (ASSUMES PATCH CDATAMAP IS 'SCALED')-%
-colormap = figure_data.Colormap;
-
-for c = 1:size((colormap),1)
- col = 255*(colormap(c,:));
- obj.data{contourIndex}.colorscale{c} = {(c-1)/(size(colormap,1)-1), ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')']};
-end
-
-%-------------------------------------------------------------------------%
-
-%-contour reverse scale-%
-obj.data{contourIndex}.reversescale = false;
-
-%---------------------------------------------------------------------%
-
-%-aspect ratio-%
-ar = obj.PlotOptions.AspectRatio;
-
-if ~isempty(ar)
- if ischar(ar)
- obj.layout.scene.aspectmode = ar;
- elseif isvector(ar) && length(ar) == 3
- xar = ar(1);
- yar = ar(2);
- zar = ar(3);
+ for c = 1:size((colormap),1)
+ col = 255*(colormap(c,:));
+ obj.data{contourIndex}.colorscale{c} = ...
+ {(c-1)/(size(colormap,1)-1), sprintf("rgb(%f,%f,%f)", col)};
end
-else
- %-define as default-%
- xar = max(xdata(:));
- yar = max(ydata(:));
- xyar = max([xar, yar]);
- zar = 0.6*xyar;
-end
-
-obj.layout.scene.aspectratio.x = xyar;
-obj.layout.scene.aspectratio.y = xyar;
-obj.layout.scene.aspectratio.z = zar;
-
-%---------------------------------------------------------------------%
-
-%-camera eye-%
-ey = obj.PlotOptions.CameraEye;
-
-if ~isempty(ey)
- if isvector(ey) && length(ey) == 3
- obj.layout.scene.camera.eye.x = ey(1);
- obj.layout.scene.camera.eye.y = ey(2);
- obj.layout.scene.camera.eye.z = ey(3);
+ %---------------------------------------------------------------------%
+
+ %-contour reverse scale-%
+ obj.data{contourIndex}.reversescale = false;
+
+ %---------------------------------------------------------------------%
+
+ %-aspect ratio-%
+ ar = obj.PlotOptions.AspectRatio;
+
+ if ~isempty(ar)
+ if ischar(ar)
+ obj.layout.scene.aspectmode = ar;
+ elseif isvector(ar) && length(ar) == 3
+ xar = ar(1);
+ yar = ar(2);
+ zar = ar(3);
+ end
+ else
+ %-define as default-%
+ xar = max(xdata(:));
+ yar = max(ydata(:));
+ xyar = max([xar, yar]);
+ zar = 0.6*xyar;
end
-else
-
- %-define as default-%
- xey = - xyar; if xey>0 xfac = -0.2; else xfac = 0.2; end
- yey = - xyar; if yey>0 yfac = -0.2; else yfac = 0.2; end
- if zar>0 zfac = 0.2; else zfac = -0.2; end
-
- obj.layout.scene.camera.eye.x = xey + xfac*xey;
- obj.layout.scene.camera.eye.y = yey + yfac*yey;
- obj.layout.scene.camera.eye.z = zar + zfac*zar;
-end
-%-------------------------------------------------------------------------%
-
-%-contour showlegend-%
+ obj.layout.scene.aspectratio.x = xyar;
+ obj.layout.scene.aspectratio.y = xyar;
+ obj.layout.scene.aspectratio.z = zar;
+
+ %---------------------------------------------------------------------%
+
+ %-camera eye-%
+ ey = obj.PlotOptions.CameraEye;
+
+ if ~isempty(ey)
+ if isvector(ey) && length(ey) == 3
+ obj.layout.scene.camera.eye.x = ey(1);
+ obj.layout.scene.camera.eye.y = ey(2);
+ obj.layout.scene.camera.eye.z = ey(3);
+ end
+ else
+ %-define as default-%
+ xey = - xyar; if xey>0 xfac = -0.2; else xfac = 0.2; end
+ yey = - xyar; if yey>0 yfac = -0.2; else yfac = 0.2; end
+ if zar>0 zfac = 0.2; else zfac = -0.2; end
+
+ obj.layout.scene.camera.eye.x = xey + xfac*xey;
+ obj.layout.scene.camera.eye.y = yey + yfac*yey;
+ obj.layout.scene.camera.eye.z = zar + zfac*zar;
+ end
-leg = contour_data.Annotation;
-legInfo = leg.LegendInformation;
+ %---------------------------------------------------------------------%
-switch legInfo.IconDisplayStyle
- case 'on'
- showleg = true;
- case 'off'
- showleg = false;
-end
+ %-contour showlegend-%
-obj.data{contourIndex}.showlegend = showleg;
+ leg = contour_data.Annotation;
+ legInfo = leg.LegendInformation;
-%-------------------------------------------------------------------------%
+ switch legInfo.IconDisplayStyle
+ case 'on'
+ showleg = true;
+ case 'off'
+ showleg = false;
+ end
+ obj.data{contourIndex}.showlegend = showleg;
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateContourgroup.m b/plotly/plotlyfig_aux/handlegraphics/updateContourgroup.m
index f32e5c6d..30dc6081 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateContourgroup.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateContourgroup.m
@@ -1,7 +1,4 @@
function obj = updateContourgroup(obj,plotIndex)
-
- %-------------------------------------------------------------------------%
-
%-INITIALIZATIONS-%
axIndex = obj.getAxisIndex(obj.State.Plot(plotIndex).AssociatedAxis);
@@ -24,18 +21,18 @@
contourSize = 2e-3;
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set trace-%
obj.data{plotIndex}.type = 'contour';
obj.data{plotIndex}.xaxis = sprintf('x%d', xSource);
obj.data{plotIndex}.yaxis = sprintf('y%d', ySource);
obj.data{plotIndex}.name = plotData.DisplayName;
- obj.data{plotIndex}.visible = strcmp(plotData.Visible,'on');
+ obj.data{plotIndex}.visible = strcmp(plotData.Visible, 'on');
obj.data{plotIndex}.xtype = 'array';
obj.data{plotIndex}.ytype = 'array';
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set trace data-%
obj.data{plotIndex}.x = xData;
@@ -48,7 +45,7 @@
obj.data{plotIndex}.contours.end = contourEnd;
obj.data{plotIndex}.contours.size = contourSize;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set trace coloring-%
obj.data{plotIndex}.zauto = false;
@@ -80,12 +77,9 @@
%-set trace legend-%
obj.data{plotIndex}.showlegend = getShowLegend(plotData);
-
- %-------------------------------------------------------------------------%
end
function contourLine = getContourLine(plotData)
-
%-initializations-%
lineStyle = plotData.LineStyle;
lineWidth = 1.5*plotData.LineWidth;
@@ -118,7 +112,6 @@
end
function colorScale = getColorScale(plotData, axisData)
-
%-initializations-%
cMap = axisData.Colormap;
nColors = size(cMap, 1);
@@ -134,7 +127,6 @@
colorScale{1} = {0, getStringColor( 255*ones(1,3) )};
cScaleInd = linspace(1/nContours, 1, nContours);
end
-
for n = 1:nContours
m = n; if isBackground, m = n+1; end
stringColor = getStringColor( 255*cMap(cMapInd(n), :) );
@@ -142,7 +134,6 @@
end
else
cScaleInd = rescale(1:nColors, 0, 1);
-
for n = 1:nColors
stringColor = getStringColor( 255*cMap(n,:) );
colorScale{n} = {cScaleInd(n), stringColor};
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateErrorbar.m b/plotly/plotlyfig_aux/handlegraphics/updateErrorbar.m
index e85f19b9..59cb3fe7 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateErrorbar.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateErrorbar.m
@@ -1,7 +1,4 @@
function obj = updateErrorbar(obj, plotIndex)
-
- %-------------------------------------------------------------------------%
-
%-INITIALIZATION-%
%-get data structures-%
@@ -14,7 +11,7 @@
xPositiveDelta = plotData.XPositiveDelta;
xNegativeDelta = plotData.XNegativeDelta;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set trace-%
@@ -31,8 +28,7 @@
%-errorbar symmetry-%
obj.data{plotIndex}.error_y.symmetric = false;
-
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set errorbar data-%
@@ -42,7 +38,7 @@
obj.data{plotIndex}.error_x.arrayminus = xNegativeDelta;
obj.data{plotIndex}.error_y.arrayminus = yNegativeDelta;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-errorbar thickness-%
obj.data{plotIndex}.error_y.thickness = plotData.LineWidth;
@@ -56,8 +52,5 @@
errorColor = getStringColor(255*plotData.Color);
obj.data{plotIndex}.error_y.color = errorColor;
obj.data{plotIndex}.error_x.color = errorColor;
-
- %-------------------------------------------------------------------------%
-
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateErrorbarseries.m b/plotly/plotlyfig_aux/handlegraphics/updateErrorbarseries.m
index a755683d..b1f91610 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateErrorbarseries.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateErrorbarseries.m
@@ -1,74 +1,45 @@
function obj = updateErrorbarseries(obj, errorbarIndex)
+ % type: ...[DONE]
+ % symmetric: ...[DONE]
+ % array: ...[DONE]
+ % value: ...[NA]
+ % arrayminus: ...{DONE]
+ % valueminus: ...[NA]
+ % color: ...[DONE]
+ % thickness: ...[DONE]
+ % width: ...[DONE]
+ % opacity: ---[TODO]
+ % visible: ...[DONE]
-% type: ...[DONE]
-% symmetric: ...[DONE]
-% array: ...[DONE]
-% value: ...[NA]
-% arrayminus: ...{DONE]
-% valueminus: ...[NA]
-% color: ...[DONE]
-% thickness: ...[DONE]
-% width: ...[DONE]
-% opacity: ---[TODO]
-% visible: ...[DONE]
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-ERRORBAR STRUCTURE-%
+ errorbar_data = obj.State.Plot(errorbarIndex).Handle;
-%-ERRORBAR STRUCTURE-%
-errorbar_data = obj.State.Plot(errorbarIndex).Handle;
+ %-ERRORBAR CHILDREN-%
+ errorbar_child = obj.State.Plot(errorbarIndex).Handle.Children;
-%-ERRORBAR CHILDREN-%
-errorbar_child = obj.State.Plot(errorbarIndex).Handle.Children;
+ %-ERROR BAR LINE CHILD-%
+ errorbar_line_child_data = errorbar_child(2);
-%-ERROR BAR LINE CHILD-%
-errorbar_line_child_data = errorbar_child(2);
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-UPDATE LINESERIES-%
+ updateLineseries(obj, errorbarIndex);
-%-UPDATE LINESERIES-%
-updateLineseries(obj, errorbarIndex);
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ obj.data{errorbarIndex}.error_y.visible = true;
+ obj.data{errorbarIndex}.error_y.type = 'data';
+ obj.data{errorbarIndex}.error_y.symmetric = false;
+ obj.data{errorbarIndex}.error_y.array = errorbar_data.UData;
+ obj.data{errorbarIndex}.error_y.arrayminus = errorbar_data.LData;
+ obj.data{errorbarIndex}.error_y.thickness = errorbar_line_child_data.LineWidth;
+ obj.data{errorbarIndex}.error_y.width = obj.PlotlyDefaults.ErrorbarWidth;
-%-errorbar visible-%
-obj.data{errorbarIndex}.error_y.visible = true;
-
-%-------------------------------------------------------------------------%
-
-%-errorbar type-%
-obj.data{errorbarIndex}.error_y.type = 'data';
-
-%-------------------------------------------------------------------------%
-
-%-errorbar symmetry-%
-obj.data{errorbarIndex}.error_y.symmetric = false;
-
-%-------------------------------------------------------------------------%
-
-%-errorbar value-%
-obj.data{errorbarIndex}.error_y.array = errorbar_data.UData;
-
-%-------------------------------------------------------------------------%
-
-%-errorbar valueminus-%
-obj.data{errorbarIndex}.error_y.arrayminus = errorbar_data.LData;
-
-%-------------------------------------------------------------------------%
-
-%-errorbar thickness-%
-obj.data{errorbarIndex}.error_y.thickness = errorbar_line_child_data.LineWidth;
-
-%-------------------------------------------------------------------------%
-
-%-errorbar width-%
-obj.data{errorbarIndex}.error_y.width = obj.PlotlyDefaults.ErrorbarWidth;
-
-%-------------------------------------------------------------------------%
-
-%-errorbar color-%
-col = 255*errorbar_line_child_data.Color;
-obj.data{errorbarIndex}.error_y.color = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];
-
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
+ %-errorbar color-%
+ col = 255*errorbar_line_child_data.Color;
+ obj.data{errorbarIndex}.error_y.color = sprintf("rgb(%f,%f,%f)", col);
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateFmesh.m b/plotly/plotlyfig_aux/handlegraphics/updateFmesh.m
index 418f3736..d3a40ad2 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateFmesh.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateFmesh.m
@@ -1,356 +1,345 @@
function obj = updateFmesh(obj, surfaceIndex)
+ %-AXIS INDEX-%
+ axIndex = obj.getAxisIndex(obj.State.Plot(surfaceIndex).AssociatedAxis);
-%-AXIS INDEX-%
-axIndex = obj.getAxisIndex(obj.State.Plot(surfaceIndex).AssociatedAxis);
+ %-CHECK FOR MULTIPLE AXES-%
+ [xsource, ysource] = findSourceAxis(obj,axIndex);
-%-CHECK FOR MULTIPLE AXES-%
-[xsource, ysource] = findSourceAxis(obj,axIndex);
+ %-SURFACE DATA STRUCTURE- %
+ meshData = obj.State.Plot(surfaceIndex).Handle;
+ figureData = obj.State.Figure.Handle;
-%-SURFACE DATA STRUCTURE- %
-meshData = obj.State.Plot(surfaceIndex).Handle;
-figureData = obj.State.Figure.Handle;
+ %-AXIS STRUCTURE-%
+ axisData = ancestor(meshData.Parent,'axes');
-%-AXIS STRUCTURE-%
-axisData = ancestor(meshData.Parent,'axes');
+ %-SCENE DATA-%
+ scene = obj.layout.("scene" + xsource);
-%-SCENE DATA-%
-scene = obj.layout.("scene" + xsource);
-
-%-GET CONTOUR INDEX-%
-obj.PlotOptions.nPlots = obj.PlotOptions.nPlots + 1;
-contourIndex = obj.PlotOptions.nPlots;
+ %-GET CONTOUR INDEX-%
+ obj.PlotOptions.nPlots = obj.PlotOptions.nPlots + 1;
+ contourIndex = obj.PlotOptions.nPlots;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-associate scene-%
-obj.data{surfaceIndex}.scene = sprintf('scene%d', xsource);
-obj.data{contourIndex}.scene = sprintf('scene%d', xsource);
+ %-associate scene-%
+ obj.data{surfaceIndex}.scene = sprintf('scene%d', xsource);
+ obj.data{contourIndex}.scene = sprintf('scene%d', xsource);
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-surface type for face color-%
-obj.data{surfaceIndex}.type = 'surface';
-
-%-scatter3d type for contour mesh lines-%
-obj.data{contourIndex}.type = 'scatter3d';
-obj.data{contourIndex}.mode = 'lines';
+ %-surface type for face color-%
+ obj.data{surfaceIndex}.type = 'surface';
+
+ %-scatter3d type for contour mesh lines-%
+ obj.data{contourIndex}.type = 'scatter3d';
+ obj.data{contourIndex}.mode = 'lines';
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-get plot data-%
-meshDensity = meshData.MeshDensity;
-xData = meshData.XData(1:meshDensity^2);
-yData = meshData.YData(1:meshDensity^2);
-zData = meshData.ZData(1:meshDensity^2);
+ %-get plot data-%
+ meshDensity = meshData.MeshDensity;
+ xData = meshData.XData(1:meshDensity^2);
+ yData = meshData.YData(1:meshDensity^2);
+ zData = meshData.ZData(1:meshDensity^2);
-%-reformat data to mesh-%
-xDataSurface = reshape(xData, [meshDensity, meshDensity])';
-yDataSurface = reshape(yData, [meshDensity, meshDensity])';
-zDataSurface = reshape(zData, [meshDensity, meshDensity])';
+ %-reformat data to mesh-%
+ xDataSurface = reshape(xData, [meshDensity, meshDensity])';
+ yDataSurface = reshape(yData, [meshDensity, meshDensity])';
+ zDataSurface = reshape(zData, [meshDensity, meshDensity])';
-xDataContour = [xDataSurface; NaN(1, size(xDataSurface, 2))];
-yDataContour = [yDataSurface; NaN(1, size(yDataSurface, 2))];
-zDataContour = [zDataSurface; NaN(1, size(zDataSurface, 2))];
+ xDataContour = [xDataSurface; NaN(1, size(xDataSurface, 2))];
+ yDataContour = [yDataSurface; NaN(1, size(yDataSurface, 2))];
+ zDataContour = [zDataSurface; NaN(1, size(zDataSurface, 2))];
-xDataContour = [xDataContour; xDataContour(1:end-1,:)'];
-yDataContour = [yDataContour; yDataContour(1:end-1,:)'];
-zDataContour = [zDataContour; zDataContour(1:end-1,:)'];
+ xDataContour = [xDataContour; xDataContour(1:end-1,:)'];
+ yDataContour = [yDataContour; yDataContour(1:end-1,:)'];
+ zDataContour = [zDataContour; zDataContour(1:end-1,:)'];
-xDataContour = [xDataContour; NaN(1, size(xDataContour, 2))];
-yDataContour = [yDataContour; NaN(1, size(yDataContour, 2))];
-zDataContour = [zDataContour; NaN(1, size(zDataContour, 2))];
+ xDataContour = [xDataContour; NaN(1, size(xDataContour, 2))];
+ yDataContour = [yDataContour; NaN(1, size(yDataContour, 2))];
+ zDataContour = [zDataContour; NaN(1, size(zDataContour, 2))];
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-set data on surface-%
-obj.data{surfaceIndex}.x = xDataSurface;
-obj.data{surfaceIndex}.y = yDataSurface;
-obj.data{surfaceIndex}.z = zDataSurface;
+ %-set data on surface-%
+ obj.data{surfaceIndex}.x = xDataSurface;
+ obj.data{surfaceIndex}.y = yDataSurface;
+ obj.data{surfaceIndex}.z = zDataSurface;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-set data on scatter3d-%
-obj.data{contourIndex}.x = xDataContour(:);
-obj.data{contourIndex}.y = yDataContour(:);
-obj.data{contourIndex}.z = zDataContour(:);
+ %-set data on scatter3d-%
+ obj.data{contourIndex}.x = xDataContour(:);
+ obj.data{contourIndex}.y = yDataContour(:);
+ obj.data{contourIndex}.z = zDataContour(:);
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-COLORING-%
+ %-COLORING-%
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-get colormap-%
-cMap = figureData.Colormap;
-fac = 1/(length(cMap)-1);
-colorScale = {};
+ %-get colormap-%
+ cMap = figureData.Colormap;
+ fac = 1/(length(cMap)-1);
+ colorScale = {};
-for c = 1: length(cMap)
- colorScale{c} = { (c-1)*fac , sprintf('rgb(%f,%f,%f)', 255*cMap(c, :))};
-end
-
-%-------------------------------------------------------------------------%
-%-get edge color-%
-if isnumeric(meshData.EdgeColor)
- cDataContour = sprintf('rgb(%f,%f,%f)', 255*meshData.EdgeColor);
-
-elseif strcmpi(meshData.EdgeColor, 'interp')
- cDataContour = zDataContour(:);
- obj.data{contourIndex}.line.colorscale = colorScale;
-elseif strcmpi(meshData.EdgeColor, 'none')
-
- cDataContour = 'rgba(0,0,0,0)';
-end
+ for c = 1: length(cMap)
+ colorScale{c} = { (c-1)*fac , sprintf('rgb(%f,%f,%f)', 255*cMap(c, :))};
+ end
-%-set edge color-%
-obj.data{contourIndex}.line.color = cDataContour;
+ %---------------------------------------------------------------------%
+ %-get edge color-%
+ if isnumeric(meshData.EdgeColor)
+ cDataContour = sprintf('rgb(%f,%f,%f)', 255*meshData.EdgeColor);
+ elseif strcmpi(meshData.EdgeColor, 'interp')
+ cDataContour = zDataContour(:);
+ obj.data{contourIndex}.line.colorscale = colorScale;
+ elseif strcmpi(meshData.EdgeColor, 'none')
+ cDataContour = 'rgba(0,0,0,0)';
+ end
-%-------------------------------------------------------------------------%
+ %-set edge color-%
+ obj.data{contourIndex}.line.color = cDataContour;
-%-get face color-%
-if isnumeric(meshData.FaceColor)
+ %---------------------------------------------------------------------%
- for n = 1:size(zDataSurface, 2)
- for m = 1:size(zDataSurface, 1)
- cDataSurface(m, n, :) = meshData.FaceColor;
+ %-get face color-%
+ if isnumeric(meshData.FaceColor)
+ for n = 1:size(zDataSurface, 2)
+ for m = 1:size(zDataSurface, 1)
+ cDataSurface(m, n, :) = meshData.FaceColor;
+ end
end
- end
-
- [cDataSurface, cMapSurface] = rgb2ind(cDataSurface, 256);
- for c = 1: size(cMapSurface, 1)
- colorScale{c} = { (c-1)*fac , sprintf('rgba(%f,%f,%f, 1)', cMapSurface(c, :))};
- end
+ [cDataSurface, cMapSurface] = rgb2ind(cDataSurface, 256);
- obj.data{surfaceIndex}.cmin = 0;
- obj.data{surfaceIndex}.cmax = 255;
+ for c = 1: size(cMapSurface, 1)
+ colorScale{c} = { (c-1)*fac , sprintf('rgba(%f,%f,%f, 1)', cMapSurface(c, :))};
+ end
-elseif strcmpi(meshData.FaceColor, 'interp')
- cDataSurface = zDataSurface;
+ obj.data{surfaceIndex}.cmin = 0;
+ obj.data{surfaceIndex}.cmax = 255;
- if surfaceIndex > xsource
- cData = [];
+ elseif strcmpi(meshData.FaceColor, 'interp')
+ cDataSurface = zDataSurface;
+ if surfaceIndex > xsource
+ cData = [];
+ for idx = xsource:surfaceIndex
+ cData = [cData; obj.data{idx}.z];
+ end
- for idx = xsource:surfaceIndex
- cData = [cData; obj.data{idx}.z];
- end
+ cMin = min(cData(:));
+ cMax = max(cData(:));
- cMin = min(cData(:));
- cMax = max(cData(:));
-
- for idx = xsource:surfaceIndex
- obj.data{idx}.cmin = cMin;
- obj.data{idx}.cmax = cMax;
+ for idx = xsource:surfaceIndex
+ obj.data{idx}.cmin = cMin;
+ obj.data{idx}.cmax = cMax;
+ end
end
end
-
-end
-%-set face color-%
-obj.data{surfaceIndex}.colorscale = colorScale;
-obj.data{surfaceIndex}.surfacecolor = cDataSurface;
+ %-set face color-%
+ obj.data{surfaceIndex}.colorscale = colorScale;
+ obj.data{surfaceIndex}.surfacecolor = cDataSurface;
-%-lighting settings-%
+ %-lighting settings-%
-if isnumeric(meshData.FaceColor) && all(meshData.FaceColor == [1, 1, 1])
- obj.data{surfaceIndex}.lighting.diffuse = 0.5;
- obj.data{surfaceIndex}.lighting.ambient = 0.725;
-else
- % obj.data{surfaceIndex}.lighting.diffuse = 1.0;
- % obj.data{surfaceIndex}.lighting.ambient = 0.9;
-end
+ if isnumeric(meshData.FaceColor) && all(meshData.FaceColor == [1, 1, 1])
+ obj.data{surfaceIndex}.lighting.diffuse = 0.5;
+ obj.data{surfaceIndex}.lighting.ambient = 0.725;
+ else
+ % obj.data{surfaceIndex}.lighting.diffuse = 1.0;
+ % obj.data{surfaceIndex}.lighting.ambient = 0.9;
+ end
-if meshData.FaceAlpha ~= 1
- obj.data{surfaceIndex}.lighting.diffuse = 0.5;
- obj.data{surfaceIndex}.lighting.ambient = 0.725 + (1-meshData.FaceAlpha);
-end
+ if meshData.FaceAlpha ~= 1
+ obj.data{surfaceIndex}.lighting.diffuse = 0.5;
+ obj.data{surfaceIndex}.lighting.ambient = 0.725 + (1-meshData.FaceAlpha);
+ end
-if obj.PlotlyDefaults.IsLight
- obj.data{surfaceIndex}.lighting.diffuse = 1.0;
- obj.data{surfaceIndex}.lighting.ambient = 0.3;
-end
+ if obj.PlotlyDefaults.IsLight
+ obj.data{surfaceIndex}.lighting.diffuse = 1.0;
+ obj.data{surfaceIndex}.lighting.ambient = 0.3;
+ end
-%-opacity-%
-obj.data{surfaceIndex}.opacity = meshData.FaceAlpha;
+ %-opacity-%
+ obj.data{surfaceIndex}.opacity = meshData.FaceAlpha;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-line style-%
+ %-line style-%
-obj.data{contourIndex}.line.width = 3*meshData.LineWidth;
+ obj.data{contourIndex}.line.width = 3*meshData.LineWidth;
-switch meshData.LineStyle
- case '-'
- obj.data{contourIndex}.line.dash = 'solid';
- case '--'
- obj.data{contourIndex}.line.dash = 'dash';
- case '-.'
- obj.data{contourIndex}.line.dash = 'dashdot';
- case ':'
- obj.data{contourIndex}.line.dash = 'dot';
-end
+ switch meshData.LineStyle
+ case '-'
+ obj.data{contourIndex}.line.dash = 'solid';
+ case '--'
+ obj.data{contourIndex}.line.dash = 'dash';
+ case '-.'
+ obj.data{contourIndex}.line.dash = 'dashdot';
+ case ':'
+ obj.data{contourIndex}.line.dash = 'dot';
+ end
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-show contours-%
+ %-show contours-%
-if strcmpi(meshData.ShowContours, 'on')
- obj.PlotOptions.nPlots = obj.PlotOptions.nPlots + 1;
- projectionIndex = obj.PlotOptions.nPlots;
+ if strcmpi(meshData.ShowContours, 'on')
+ obj.PlotOptions.nPlots = obj.PlotOptions.nPlots + 1;
+ projectionIndex = obj.PlotOptions.nPlots;
- obj.data{projectionIndex}.type = 'surface';
- obj.data{projectionIndex}.scene = sprintf('scene%d', xsource);
+ obj.data{projectionIndex}.type = 'surface';
+ obj.data{projectionIndex}.scene = sprintf('scene%d', xsource);
- obj.data{projectionIndex}.x = xDataSurface;
- obj.data{projectionIndex}.y = yDataSurface;
- obj.data{projectionIndex}.z = zDataSurface;
+ obj.data{projectionIndex}.x = xDataSurface;
+ obj.data{projectionIndex}.y = yDataSurface;
+ obj.data{projectionIndex}.z = zDataSurface;
- obj.data{projectionIndex}.colorscale = colorScale;
- obj.data{projectionIndex}.hidesurface = true;
- obj.data{projectionIndex}.surfacecolor = zDataSurface;
- obj.data{projectionIndex}.showscale = false;
+ obj.data{projectionIndex}.colorscale = colorScale;
+ obj.data{projectionIndex}.hidesurface = true;
+ obj.data{projectionIndex}.surfacecolor = zDataSurface;
+ obj.data{projectionIndex}.showscale = false;
- obj.data{projectionIndex}.contours.z.show = true;
- obj.data{projectionIndex}.contours.z.width = 15;
- obj.data{projectionIndex}.contours.z.usecolormap = true;
- obj.data{projectionIndex}.contours.z.project.z = true;
-end
+ obj.data{projectionIndex}.contours.z.show = true;
+ obj.data{projectionIndex}.contours.z.width = 15;
+ obj.data{projectionIndex}.contours.z.usecolormap = true;
+ obj.data{projectionIndex}.contours.z.project.z = true;
+ end
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-SCENE CONFIGUTATION-%
+ %-SCENE CONFIGUTATION-%
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-aspect ratio-%
-asr = obj.PlotOptions.AspectRatio;
+ %-aspect ratio-%
+ asr = obj.PlotOptions.AspectRatio;
-if ~isempty(asr)
- if ischar(asr)
- scene.aspectmode = asr;
- elseif isvector(ar) && length(asr) == 3
- xar = asr(1);
- yar = asr(2);
- zar = asr(3);
- end
-else
+ if ~isempty(asr)
+ if ischar(asr)
+ scene.aspectmode = asr;
+ elseif isvector(ar) && length(asr) == 3
+ xar = asr(1);
+ yar = asr(2);
+ zar = asr(3);
+ end
+ else
- %-define as default-%
- xar = max(xData(:));
- yar = max(yData(:));
- xyar = max([xar, yar]);
- zar = 0.75*xyar;
-end
+ %-define as default-%
+ xar = max(xData(:));
+ yar = max(yData(:));
+ xyar = max([xar, yar]);
+ zar = 0.75*xyar;
+ end
-scene.aspectratio.x = 1.1*xyar;
-scene.aspectratio.y = 1.0*xyar;
-scene.aspectratio.z = zar;
+ scene.aspectratio.x = 1.1*xyar;
+ scene.aspectratio.y = 1.0*xyar;
+ scene.aspectratio.z = zar;
-%---------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-camera eye-%
-ey = obj.PlotOptions.CameraEye;
+ %-camera eye-%
+ ey = obj.PlotOptions.CameraEye;
-if ~isempty(ey)
- if isvector(ey) && length(ey) == 3
- scene.camera.eye.x = ey(1);
- scene.camera.eye.y = ey(2);
- scene.camera.eye.z = ey(3);
+ if ~isempty(ey)
+ if isvector(ey) && length(ey) == 3
+ scene.camera.eye.x = ey(1);
+ scene.camera.eye.y = ey(2);
+ scene.camera.eye.z = ey(3);
+ end
+ else
+ %-define as default-%
+ xey = - xyar; if xey>0 xfac = -0.0; else xfac = 0.0; end
+ yey = - xyar; if yey>0 yfac = -0.3; else yfac = 0.3; end
+ if zar>0 zfac = 0.1; else zfac = -0.1; end
+
+ scene.camera.eye.x = xey + xfac*xey;
+ scene.camera.eye.y = yey + yfac*yey;
+ scene.camera.eye.z = zar + zfac*zar;
end
-else
-
- %-define as default-%
- xey = - xyar; if xey>0 xfac = 0.0; else xfac = 0.0; end
- yey = - xyar; if yey>0 yfac = -0.3; else yfac = 0.3; end
- if zar>0 zfac = 0.1; else zfac = -0.1; end
-
- scene.camera.eye.x = xey + xfac*xey;
- scene.camera.eye.y = yey + yfac*yey;
- scene.camera.eye.z = zar + zfac*zar;
-end
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-scene axis configuration-%
+ %-scene axis configuration-%
-scene.xaxis.range = axisData.XLim;
-scene.yaxis.range = axisData.YLim;
-scene.zaxis.range = axisData.ZLim;
+ scene.xaxis.range = axisData.XLim;
+ scene.yaxis.range = axisData.YLim;
+ scene.zaxis.range = axisData.ZLim;
-scene.xaxis.tickvals = axisData.XTick;
-scene.xaxis.ticktext = axisData.XTickLabel;
+ scene.xaxis.tickvals = axisData.XTick;
+ scene.xaxis.ticktext = axisData.XTickLabel;
-scene.yaxis.tickvals = axisData.YTick;
-scene.yaxis.ticktext = axisData.YTickLabel;
+ scene.yaxis.tickvals = axisData.YTick;
+ scene.yaxis.ticktext = axisData.YTickLabel;
-scene.zaxis.tickvals = axisData.ZTick;
-scene.zaxis.ticktext = axisData.ZTickLabel;
+ scene.zaxis.tickvals = axisData.ZTick;
+ scene.zaxis.ticktext = axisData.ZTickLabel;
-scene.xaxis.zeroline = false;
-scene.yaxis.zeroline = false;
-scene.zaxis.zeroline = false;
+ scene.xaxis.zeroline = false;
+ scene.yaxis.zeroline = false;
+ scene.zaxis.zeroline = false;
-scene.xaxis.showline = true;
-scene.yaxis.showline = true;
-scene.zaxis.showline = true;
+ scene.xaxis.showline = true;
+ scene.yaxis.showline = true;
+ scene.zaxis.showline = true;
-scene.xaxis.tickcolor = 'rgba(0,0,0,1)';
-scene.yaxis.tickcolor = 'rgba(0,0,0,1)';
-scene.zaxis.tickcolor = 'rgba(0,0,0,1)';
+ scene.xaxis.tickcolor = 'rgba(0,0,0,1)';
+ scene.yaxis.tickcolor = 'rgba(0,0,0,1)';
+ scene.zaxis.tickcolor = 'rgba(0,0,0,1)';
-scene.xaxis.ticklabelposition = 'outside';
-scene.yaxis.ticklabelposition = 'outside';
-scene.zaxis.ticklabelposition = 'outside';
+ scene.xaxis.ticklabelposition = 'outside';
+ scene.yaxis.ticklabelposition = 'outside';
+ scene.zaxis.ticklabelposition = 'outside';
-scene.xaxis.title = axisData.XLabel.String;
-scene.yaxis.title = axisData.YLabel.String;
-scene.zaxis.title = axisData.ZLabel.String;
+ scene.xaxis.title = axisData.XLabel.String;
+ scene.yaxis.title = axisData.YLabel.String;
+ scene.zaxis.title = axisData.ZLabel.String;
-scene.xaxis.tickfont.size = axisData.FontSize;
-scene.yaxis.tickfont.size = axisData.FontSize;
-scene.zaxis.tickfont.size = axisData.FontSize;
+ scene.xaxis.tickfont.size = axisData.FontSize;
+ scene.yaxis.tickfont.size = axisData.FontSize;
+ scene.zaxis.tickfont.size = axisData.FontSize;
-scene.xaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
-scene.yaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
-scene.zaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
+ scene.xaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
+ scene.yaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
+ scene.zaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-SET SCENE TO LAYOUT-%
-obj.layout = setfield(obj.layout, sprintf('scene%d', xsource), scene);
+ %-SET SCENE TO LAYOUT-%
+ obj.layout = setfield(obj.layout, sprintf('scene%d', xsource), scene);
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-surface name-%
-obj.data{surfaceIndex}.name = meshData.DisplayName;
-obj.data{contourIndex}.name = meshData.DisplayName;
+ %-surface name-%
+ obj.data{surfaceIndex}.name = meshData.DisplayName;
+ obj.data{contourIndex}.name = meshData.DisplayName;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-surface showscale-%
-obj.data{surfaceIndex}.showscale = false;
-obj.data{contourIndex}.showscale = false;
+ %-surface showscale-%
+ obj.data{surfaceIndex}.showscale = false;
+ obj.data{contourIndex}.showscale = false;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-surface visible-%
-obj.data{surfaceIndex}.visible = strcmp(meshData.Visible,'on');
-obj.data{contourIndex}.visible = strcmp(meshData.Visible,'on');
+ %-surface visible-%
+ obj.data{surfaceIndex}.visible = strcmp(meshData.Visible,'on');
+ obj.data{contourIndex}.visible = strcmp(meshData.Visible,'on');
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-leg = meshData.Annotation;
-legInfo = leg.LegendInformation;
+ leg = meshData.Annotation;
+ legInfo = leg.LegendInformation;
-switch legInfo.IconDisplayStyle
- case 'on'
- showleg = true;
- case 'off'
- showleg = false;
-end
-
-obj.data{surfaceIndex}.showlegend = showleg;
-
-%-------------------------------------------------------------------------%
+ switch legInfo.IconDisplayStyle
+ case 'on'
+ showleg = true;
+ case 'off'
+ showleg = false;
+ end
+ obj.data{surfaceIndex}.showlegend = showleg;
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateFunctionContour.m b/plotly/plotlyfig_aux/handlegraphics/updateFunctionContour.m
index 36741031..6b95c42a 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateFunctionContour.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateFunctionContour.m
@@ -1,229 +1,184 @@
function obj = updateFunctionContour(obj,contourIndex)
+ %-FIGURE DATA STRUCTURE-%
+ figure_data = obj.State.Figure.Handle;
-%-FIGURE DATA STRUCTURE-%
-figure_data = obj.State.Figure.Handle;
+ %-AXIS INDEX-%
+ axIndex = obj.getAxisIndex(obj.State.Plot(contourIndex).AssociatedAxis);
-%-AXIS INDEX-%
-axIndex = obj.getAxisIndex(obj.State.Plot(contourIndex).AssociatedAxis);
+ %-AXIS DATA STRUCTURE-%
+ axis_data = obj.State.Plot(contourIndex).AssociatedAxis;
-%-AXIS DATA STRUCTURE-%
-axis_data = obj.State.Plot(contourIndex).AssociatedAxis;
+ %-PLOT DATA STRUCTURE- %
+ contour_data = obj.State.Plot(contourIndex).Handle;
-%-PLOT DATA STRUCTURE- %
-contour_data = obj.State.Plot(contourIndex).Handle;
+ %-CHECK FOR MULTIPLE AXES-%
+ [xsource, ysource] = findSourceAxis(obj,axIndex);
-%-CHECK FOR MULTIPLE AXES-%
-[xsource, ysource] = findSourceAxis(obj,axIndex);
+ %-AXIS DATA-%
+ xaxis = obj.layout.("xaxis" + xsource);
+ yaxis = obj.layout.("yaxis" + ysource);
-%-AXIS DATA-%
-xaxis = obj.layout.("xaxis" + xsource);
-yaxis = obj.layout.("yaxis" + ysource);
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-contour xaxis and yaxis-%
+ obj.data{contourIndex}.xaxis = ['x' num2str(xsource)];
+ obj.data{contourIndex}.yaxis = ['y' num2str(ysource)];
-%-contour xaxis-%
-obj.data{contourIndex}.xaxis = ['x' num2str(xsource)];
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-contour name-%
+ obj.data{contourIndex}.name = contour_data.DisplayName;
-%-contour yaxis-%
-obj.data{contourIndex}.yaxis = ['y' num2str(ysource)];
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-contour type-%
+ obj.data{contourIndex}.type = 'contour';
-%-contour name-%
-obj.data{contourIndex}.name = contour_data.DisplayName;
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-setting the plot-%
+ xdata = contour_data.XData;
+ ydata = contour_data.YData;
+ zdata = contour_data.ZData;
-%-contour type-%
-obj.data{contourIndex}.type = 'contour';
-
-%-------------------------------------------------------------------------%
-
-%-setting the plot-%
-xdata = contour_data.XData;
-ydata = contour_data.YData;
-zdata = contour_data.ZData;
-
-%-contour x data-%
-if ~isvector(xdata)
- obj.data{contourIndex}.x = xdata(1,:);
-else
- obj.data{contourIndex}.x = xdata;
-end
-
-%-contour y data-%
-if ~isvector(ydata)
- obj.data{contourIndex}.y = ydata(:,1);
-else
- obj.data{contourIndex}.y = ydata;
-end
-
-%-contour z data-%
-obj.data{contourIndex}.z = zdata;
-
-%-------------------------------------------------------------------------%
-
-%-contour x type-%
-
-obj.data{contourIndex}.xtype = 'array';
-
-%-------------------------------------------------------------------------%
-
-%-contour y type-%
-
-obj.data{contourIndex}.ytype = 'array';
-
-%-------------------------------------------------------------------------%
-
-%-contour visible-%
-
-obj.data{contourIndex}.visible = strcmp(contour_data.Visible,'on');
-
-%-------------------------------------------------------------------------%
-
-%-contour showscale-%
-obj.data{contourIndex}.showscale = false;
-
-%-------------------------------------------------------------------------%
-
-%-zauto-%
-obj.data{contourIndex}.zauto = false;
-
-%-------------------------------------------------------------------------%
-
-%-zmin-%
-obj.data{contourIndex}.zmin = axis_data.CLim(1);
-
-%-------------------------------------------------------------------------%
-
-%-zmax-%
-obj.data{contourIndex}.zmax = axis_data.CLim(2);
+ %-contour x data-%
+ if ~isvector(xdata)
+ obj.data{contourIndex}.x = xdata(1,:);
+ else
+ obj.data{contourIndex}.x = xdata;
+ end
-%-------------------------------------------------------------------------%
+ %-contour y data-%
+ if ~isvector(ydata)
+ obj.data{contourIndex}.y = ydata(:,1);
+ else
+ obj.data{contourIndex}.y = ydata;
+ end
-%-colorscale (ASSUMES PATCH CDATAMAP IS 'SCALED')-%
-colormap = figure_data.Colormap;
+ %-contour z data-%
+ obj.data{contourIndex}.z = zdata;
-for c = 1:size((colormap),1)
- col = 255*(colormap(c,:));
- obj.data{contourIndex}.colorscale{c} = {(c-1)/(size(colormap,1)-1), ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')']};
-end
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ obj.data{contourIndex}.xtype = 'array';
+ obj.data{contourIndex}.ytype = 'array';
+ obj.data{contourIndex}.visible = strcmp(contour_data.Visible,'on');
+ obj.data{contourIndex}.showscale = false;
+ obj.data{contourIndex}.zauto = false;
+ obj.data{contourIndex}.zmin = axis_data.CLim(1);
+ obj.data{contourIndex}.zmax = axis_data.CLim(2);
-%-contour reverse scale-%
-obj.data{contourIndex}.reversescale = false;
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-colorscale (ASSUMES PATCH CDATAMAP IS 'SCALED')-%
+ colormap = figure_data.Colormap;
-%-autocontour-%
-obj.data{contourIndex}.autocontour = false;
+ for c = 1:size((colormap),1)
+ col = 255*(colormap(c,:));
+ obj.data{contourIndex}.colorscale{c} = ...
+ {(c-1)/(size(colormap,1)-1), sprintf("rgb(%f,%f,%f)", col)};
+ end
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-contour contours-%
+ obj.data{contourIndex}.reversescale = false;
+ obj.data{contourIndex}.autocontour = false;
-%-coloring-%
-switch contour_data.Fill
- case 'off'
- obj.data{contourIndex}.contours.coloring = 'lines';
- case 'on'
- obj.data{contourIndex}.contours.coloring = 'fill';
-end
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
-
-%-contour levels-%
-if length(contour_data.LevelList) > 1
- cstart = contour_data.LevelList(1);
- cend = contour_data.LevelList(end);
- csize = mean(diff(contour_data.LevelList));
-else
- cstart = contour_data.LevelList(1) - 1e-3;
- cend = contour_data.LevelList(end) + 1e-3;
- csize = 2e-3;
-end
+ %-contour contours-%
-%-start-%
-obj.data{contourIndex}.contours.start = cstart;
-
-%-end-%
-obj.data{contourIndex}.contours.end = cend;
-
-%-step-%
-obj.data{contourIndex}.contours.size = csize;
+ %-coloring-%
+ switch contour_data.Fill
+ case 'off'
+ obj.data{contourIndex}.contours.coloring = 'lines';
+ case 'on'
+ obj.data{contourIndex}.contours.coloring = 'fill';
+ end
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-if(~strcmp(contour_data.LineStyle,'none'))
-
- %-contour line colour-%
- if isnumeric(contour_data.LineColor)
- col = 255*contour_data.LineColor;
- obj.data{contourIndex}.line.color = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];
+ %-contour levels-%
+ if length(contour_data.LevelList) > 1
+ cstart = contour_data.LevelList(1);
+ cend = contour_data.LevelList(end);
+ csize = mean(diff(contour_data.LevelList));
else
- obj.data{contourIndex}.line.color = 'rgba(0,0,0,0)';
+ cstart = contour_data.LevelList(1) - 1e-3;
+ cend = contour_data.LevelList(end) + 1e-3;
+ csize = 2e-3;
end
-
- %-contour line width-%
- obj.data{contourIndex}.line.width = contour_data.LineWidth;
-
- %-contour line dash-%
- switch contour_data.LineStyle
- case '-'
- LineStyle = 'solid';
- case '--'
- LineStyle = 'dash';
- case ':'
- LineStyle = 'dot';
- case '-.'
- LineStyle = 'dashdot';
- end
-
- obj.data{contourIndex}.line.dash = LineStyle;
-
- %-contour smoothing-%
- obj.data{contourIndex}.line.smoothing = 0;
-
-else
-
- %-contours showlines-%
- obj.data{contourIndex}.contours.showlines = false;
-
-end
-%-------------------------------------------------------------------------%
+ %-start-%
+ obj.data{contourIndex}.contours.start = cstart;
+
+ %-end-%
+ obj.data{contourIndex}.contours.end = cend;
+
+ %-step-%
+ obj.data{contourIndex}.contours.size = csize;
+
+ %---------------------------------------------------------------------%
+
+ if (~strcmp(contour_data.LineStyle,'none'))
+ %-contour line colour-%
+ if isnumeric(contour_data.LineColor)
+ col = 255*contour_data.LineColor;
+ obj.data{contourIndex}.line.color = sprintf("rgb(%f,%f,%f)", col);
+ else
+ obj.data{contourIndex}.line.color = 'rgba(0,0,0,0)';
+ end
+
+ %-contour line width-%
+ obj.data{contourIndex}.line.width = contour_data.LineWidth;
+
+ %-contour line dash-%
+ switch contour_data.LineStyle
+ case '-'
+ LineStyle = 'solid';
+ case '--'
+ LineStyle = 'dash';
+ case ':'
+ LineStyle = 'dot';
+ case '-.'
+ LineStyle = 'dashdot';
+ end
+ obj.data{contourIndex}.line.dash = LineStyle;
+
+ %-contour smoothing-%
+ obj.data{contourIndex}.line.smoothing = 0;
+ else
+ %-contours showlines-%
+ obj.data{contourIndex}.contours.showlines = false;
+ end
-%-contour showlegend-%
+ %---------------------------------------------------------------------%
-leg = contour_data.Annotation;
-legInfo = leg.LegendInformation;
+ %-contour showlegend-%
-switch legInfo.IconDisplayStyle
- case 'on'
- showleg = true;
- case 'off'
- showleg = false;
-end
+ leg = contour_data.Annotation;
+ legInfo = leg.LegendInformation;
-obj.data{contourIndex}.showlegend = showleg;
-
-%-------------------------------------------------------------------------%
+ switch legInfo.IconDisplayStyle
+ case 'on'
+ showleg = true;
+ case 'off'
+ showleg = false;
+ end
-%-axis layout-%
-t = 'linear';
-obj.layout.("xaxis" + xsource).type=t;
-obj.layout.("xaxis" + xsource).autorange=true;
-obj.layout.("xaxis" + xsource).ticktext=axis_data.XTickLabel;
-obj.layout.("xaxis" + xsource).tickvals=axis_data.XTick;
+ obj.data{contourIndex}.showlegend = showleg;
-obj.layout.("yaxis" + xsource).type=t;
-obj.layout.("yaxis" + xsource).autorange=true;
-obj.layout.("yaxis" + xsource).ticktext=axis_data.YTickLabel;
-obj.layout.("yaxis" + xsource).tickvals=axis_data.YTick;
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-axis layout-%
+ t = 'linear';
+ obj.layout.("xaxis" + xsource).type=t;
+ obj.layout.("xaxis" + xsource).autorange=true;
+ obj.layout.("xaxis" + xsource).ticktext=axis_data.XTickLabel;
+ obj.layout.("xaxis" + xsource).tickvals=axis_data.XTick;
+ obj.layout.("yaxis" + xsource).type=t;
+ obj.layout.("yaxis" + xsource).autorange=true;
+ obj.layout.("yaxis" + xsource).ticktext=axis_data.YTickLabel;
+ obj.layout.("yaxis" + xsource).tickvals=axis_data.YTick;
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateFunctionSurface.m b/plotly/plotlyfig_aux/handlegraphics/updateFunctionSurface.m
index 1300b8df..b4dcb2e7 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateFunctionSurface.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateFunctionSurface.m
@@ -1,356 +1,344 @@
function obj = updateFunctionSurface(obj, surfaceIndex)
+ %-AXIS INDEX-%
+ axIndex = obj.getAxisIndex(obj.State.Plot(surfaceIndex).AssociatedAxis);
-%-AXIS INDEX-%
-axIndex = obj.getAxisIndex(obj.State.Plot(surfaceIndex).AssociatedAxis);
+ %-CHECK FOR MULTIPLE AXES-%
+ [xsource, ysource] = findSourceAxis(obj,axIndex);
-%-CHECK FOR MULTIPLE AXES-%
-[xsource, ysource] = findSourceAxis(obj,axIndex);
+ %-SURFACE DATA STRUCTURE- %
+ meshData = obj.State.Plot(surfaceIndex).Handle;
+ figureData = obj.State.Figure.Handle;
-%-SURFACE DATA STRUCTURE- %
-meshData = obj.State.Plot(surfaceIndex).Handle;
-figureData = obj.State.Figure.Handle;
+ %-AXIS STRUCTURE-%
+ axisData = ancestor(meshData.Parent,'axes');
-%-AXIS STRUCTURE-%
-axisData = ancestor(meshData.Parent,'axes');
+ %-SCENE DATA-%
+ scene = obj.layout.("scene" + xsource);
-%-SCENE DATA-%
-scene = obj.layout.("scene" + xsource);
-
-%-GET CONTOUR INDEX-%
-obj.PlotOptions.nPlots = obj.PlotOptions.nPlots + 1;
-contourIndex = obj.PlotOptions.nPlots;
-
-%-------------------------------------------------------------------------%
-
-%-associate scene-%
-obj.data{surfaceIndex}.scene = sprintf('scene%d', xsource);
-obj.data{contourIndex}.scene = sprintf('scene%d', xsource);
-
-%-------------------------------------------------------------------------%
-
-%-surface type for face color-%
-obj.data{surfaceIndex}.type = 'surface';
-
-%-scatter3d type for contour mesh lines-%
-obj.data{contourIndex}.type = 'scatter3d';
-obj.data{contourIndex}.mode = 'lines';
-
-%-------------------------------------------------------------------------%
+ %-GET CONTOUR INDEX-%
+ obj.PlotOptions.nPlots = obj.PlotOptions.nPlots + 1;
+ contourIndex = obj.PlotOptions.nPlots;
-%-get plot data-%
-meshDensity = meshData.MeshDensity;
-xData = meshData.XData(1:meshDensity^2);
-yData = meshData.YData(1:meshDensity^2);
-zData = meshData.ZData(1:meshDensity^2);
+ %---------------------------------------------------------------------%
-%-reformat data to mesh-%
-xDataSurface = reshape(xData, [meshDensity, meshDensity])';
-yDataSurface = reshape(yData, [meshDensity, meshDensity])';
-zDataSurface = reshape(zData, [meshDensity, meshDensity])';
+ %-associate scene-%
+ obj.data{surfaceIndex}.scene = sprintf('scene%d', xsource);
+ obj.data{contourIndex}.scene = sprintf('scene%d', xsource);
-xDataContour = [xDataSurface; NaN(1, size(xDataSurface, 2))];
-yDataContour = [yDataSurface; NaN(1, size(yDataSurface, 2))];
-zDataContour = [zDataSurface; NaN(1, size(zDataSurface, 2))];
+ %---------------------------------------------------------------------%
-xDataContour = [xDataContour; xDataContour(1:end-1,:)'];
-yDataContour = [yDataContour; yDataContour(1:end-1,:)'];
-zDataContour = [zDataContour; zDataContour(1:end-1,:)'];
+ %-surface type for face color-%
+ obj.data{surfaceIndex}.type = 'surface';
+
+ %-scatter3d type for contour mesh lines-%
+ obj.data{contourIndex}.type = 'scatter3d';
+ obj.data{contourIndex}.mode = 'lines';
-xDataContour = [xDataContour; NaN(1, size(xDataContour, 2))];
-yDataContour = [yDataContour; NaN(1, size(yDataContour, 2))];
-zDataContour = [zDataContour; NaN(1, size(zDataContour, 2))];
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-get plot data-%
+ meshDensity = meshData.MeshDensity;
+ xData = meshData.XData(1:meshDensity^2);
+ yData = meshData.YData(1:meshDensity^2);
+ zData = meshData.ZData(1:meshDensity^2);
-%-set data on surface-%
-obj.data{surfaceIndex}.x = xDataSurface;
-obj.data{surfaceIndex}.y = yDataSurface;
-obj.data{surfaceIndex}.z = zDataSurface;
+ %-reformat data to mesh-%
+ xDataSurface = reshape(xData, [meshDensity, meshDensity])';
+ yDataSurface = reshape(yData, [meshDensity, meshDensity])';
+ zDataSurface = reshape(zData, [meshDensity, meshDensity])';
-%-------------------------------------------------------------------------%
+ xDataContour = [xDataSurface; NaN(1, size(xDataSurface, 2))];
+ yDataContour = [yDataSurface; NaN(1, size(yDataSurface, 2))];
+ zDataContour = [zDataSurface; NaN(1, size(zDataSurface, 2))];
-%-set data on scatter3d-%
-obj.data{contourIndex}.x = xDataContour(:);
-obj.data{contourIndex}.y = yDataContour(:);
-obj.data{contourIndex}.z = zDataContour(:);
+ xDataContour = [xDataContour; xDataContour(1:end-1,:)'];
+ yDataContour = [yDataContour; yDataContour(1:end-1,:)'];
+ zDataContour = [zDataContour; zDataContour(1:end-1,:)'];
-%-------------------------------------------------------------------------%
+ xDataContour = [xDataContour; NaN(1, size(xDataContour, 2))];
+ yDataContour = [yDataContour; NaN(1, size(yDataContour, 2))];
+ zDataContour = [zDataContour; NaN(1, size(zDataContour, 2))];
-%-COLORING-%
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-set data on surface-%
+ obj.data{surfaceIndex}.x = xDataSurface;
+ obj.data{surfaceIndex}.y = yDataSurface;
+ obj.data{surfaceIndex}.z = zDataSurface;
-%-get colormap-%
-cMap = figureData.Colormap;
-fac = 1/(length(cMap)-1);
-colorScale = {};
+ %---------------------------------------------------------------------%
-for c = 1: length(cMap)
- colorScale{c} = { (c-1)*fac , sprintf('rgb(%f,%f,%f)', 255*cMap(c, :))};
-end
+ %-set data on scatter3d-%
+ obj.data{contourIndex}.x = xDataContour(:);
+ obj.data{contourIndex}.y = yDataContour(:);
+ obj.data{contourIndex}.z = zDataContour(:);
-%-------------------------------------------------------------------------%
-%-get edge color-%
-if isnumeric(meshData.EdgeColor)
- cDataContour = sprintf('rgb(%f,%f,%f)', 255*meshData.EdgeColor);
-
-elseif strcmpi(meshData.EdgeColor, 'interp')
- cDataContour = zDataContour(:);
- obj.data{contourIndex}.line.colorscale = colorScale;
-elseif strcmpi(meshData.EdgeColor, 'none')
-
- cDataContour = 'rgba(0,0,0,0)';
-end
+ %---------------------------------------------------------------------%
-%-set edge color-%
-obj.data{contourIndex}.line.color = cDataContour;
+ %-COLORING-%
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-get face color-%
-if isnumeric(meshData.FaceColor)
+ %-get colormap-%
+ cMap = figureData.Colormap;
+ fac = 1/(length(cMap)-1);
+ colorScale = {};
- for n = 1:size(zDataSurface, 2)
- for m = 1:size(zDataSurface, 1)
- cDataSurface(m, n, :) = meshData.FaceColor;
- end
+ for c = 1: length(cMap)
+ colorScale{c} = { (c-1)*fac , sprintf('rgb(%f,%f,%f)', 255*cMap(c, :))};
end
- [cDataSurface, cMapSurface] = rgb2ind(cDataSurface, 256);
-
- for c = 1: size(cMapSurface, 1)
- colorScale{c} = { (c-1)*fac , sprintf('rgba(%f,%f,%f, 1)', cMapSurface(c, :))};
+ %---------------------------------------------------------------------%
+ %-get edge color-%
+ if isnumeric(meshData.EdgeColor)
+ cDataContour = sprintf('rgb(%f,%f,%f)', 255*meshData.EdgeColor);
+ elseif strcmpi(meshData.EdgeColor, 'interp')
+ cDataContour = zDataContour(:);
+ obj.data{contourIndex}.line.colorscale = colorScale;
+ elseif strcmpi(meshData.EdgeColor, 'none')
+ cDataContour = 'rgba(0,0,0,0)';
end
- obj.data{surfaceIndex}.cmin = 0;
- obj.data{surfaceIndex}.cmax = 255;
-
-elseif strcmpi(meshData.FaceColor, 'interp')
- cDataSurface = zDataSurface;
+ %-set edge color-%
+ obj.data{contourIndex}.line.color = cDataContour;
- if surfaceIndex > xsource
- cData = [];
+ %---------------------------------------------------------------------%
- for idx = xsource:surfaceIndex
- cData = [cData; obj.data{idx}.z];
+ %-get face color-%
+ if isnumeric(meshData.FaceColor)
+ for n = 1:size(zDataSurface, 2)
+ for m = 1:size(zDataSurface, 1)
+ cDataSurface(m, n, :) = meshData.FaceColor;
+ end
end
- cMin = min(cData(:));
- cMax = max(cData(:));
+ [cDataSurface, cMapSurface] = rgb2ind(cDataSurface, 256);
+
+ for c = 1: size(cMapSurface, 1)
+ colorScale{c} = { (c-1)*fac , sprintf('rgba(%f,%f,%f, 1)', cMapSurface(c, :))};
+ end
- for idx = xsource:surfaceIndex
- obj.data{idx}.cmin = cMin;
- obj.data{idx}.cmax = cMax;
+ obj.data{surfaceIndex}.cmin = 0;
+ obj.data{surfaceIndex}.cmax = 255;
+ elseif strcmpi(meshData.FaceColor, 'interp')
+ cDataSurface = zDataSurface;
+ if surfaceIndex > xsource
+ cData = [];
+ for idx = xsource:surfaceIndex
+ cData = [cData; obj.data{idx}.z];
+ end
+
+ cMin = min(cData(:));
+ cMax = max(cData(:));
+
+ for idx = xsource:surfaceIndex
+ obj.data{idx}.cmin = cMin;
+ obj.data{idx}.cmax = cMax;
+ end
end
end
-
-end
-%-set face color-%
-obj.data{surfaceIndex}.colorscale = colorScale;
-obj.data{surfaceIndex}.surfacecolor = cDataSurface;
+ %-set face color-%
+ obj.data{surfaceIndex}.colorscale = colorScale;
+ obj.data{surfaceIndex}.surfacecolor = cDataSurface;
-%-lighting settings-%
+ %-lighting settings-%
-if isnumeric(meshData.FaceColor) && all(meshData.FaceColor == [1, 1, 1])
- obj.data{surfaceIndex}.lighting.diffuse = 0.5;
- obj.data{surfaceIndex}.lighting.ambient = 0.725;
-else
- % obj.data{surfaceIndex}.lighting.diffuse = 1.0;
- % obj.data{surfaceIndex}.lighting.ambient = 0.9;
-end
+ if isnumeric(meshData.FaceColor) && all(meshData.FaceColor == [1, 1, 1])
+ obj.data{surfaceIndex}.lighting.diffuse = 0.5;
+ obj.data{surfaceIndex}.lighting.ambient = 0.725;
+ else
+ % obj.data{surfaceIndex}.lighting.diffuse = 1.0;
+ % obj.data{surfaceIndex}.lighting.ambient = 0.9;
+ end
-if meshData.FaceAlpha ~= 1
- obj.data{surfaceIndex}.lighting.diffuse = 0.5;
- obj.data{surfaceIndex}.lighting.ambient = 0.725 + (1-meshData.FaceAlpha);
-end
+ if meshData.FaceAlpha ~= 1
+ obj.data{surfaceIndex}.lighting.diffuse = 0.5;
+ obj.data{surfaceIndex}.lighting.ambient = 0.725 + (1-meshData.FaceAlpha);
+ end
-if obj.PlotlyDefaults.IsLight
- obj.data{surfaceIndex}.lighting.diffuse = 1.0;
- obj.data{surfaceIndex}.lighting.ambient = 0.3;
-end
+ if obj.PlotlyDefaults.IsLight
+ obj.data{surfaceIndex}.lighting.diffuse = 1.0;
+ obj.data{surfaceIndex}.lighting.ambient = 0.3;
+ end
-%-opacity-%
-obj.data{surfaceIndex}.opacity = meshData.FaceAlpha;
+ %-opacity-%
+ obj.data{surfaceIndex}.opacity = meshData.FaceAlpha;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-line style-%
+ %-line style-%
-obj.data{contourIndex}.line.width = 3*meshData.LineWidth;
+ obj.data{contourIndex}.line.width = 3*meshData.LineWidth;
-switch meshData.LineStyle
- case '-'
- obj.data{contourIndex}.line.dash = 'solid';
- case '--'
- obj.data{contourIndex}.line.dash = 'dash';
- case '-.'
- obj.data{contourIndex}.line.dash = 'dashdot';
- case ':'
- obj.data{contourIndex}.line.dash = 'dot';
-end
+ switch meshData.LineStyle
+ case '-'
+ obj.data{contourIndex}.line.dash = 'solid';
+ case '--'
+ obj.data{contourIndex}.line.dash = 'dash';
+ case '-.'
+ obj.data{contourIndex}.line.dash = 'dashdot';
+ case ':'
+ obj.data{contourIndex}.line.dash = 'dot';
+ end
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-show contours-%
+ %-show contours-%
-if strcmpi(meshData.ShowContours, 'on')
- obj.PlotOptions.nPlots = obj.PlotOptions.nPlots + 1;
- projectionIndex = obj.PlotOptions.nPlots;
+ if strcmpi(meshData.ShowContours, 'on')
+ obj.PlotOptions.nPlots = obj.PlotOptions.nPlots + 1;
+ projectionIndex = obj.PlotOptions.nPlots;
- obj.data{projectionIndex}.type = 'surface';
- obj.data{projectionIndex}.scene = sprintf('scene%d', xsource);
+ obj.data{projectionIndex}.type = 'surface';
+ obj.data{projectionIndex}.scene = sprintf('scene%d', xsource);
- obj.data{projectionIndex}.x = xDataSurface;
- obj.data{projectionIndex}.y = yDataSurface;
- obj.data{projectionIndex}.z = zDataSurface;
+ obj.data{projectionIndex}.x = xDataSurface;
+ obj.data{projectionIndex}.y = yDataSurface;
+ obj.data{projectionIndex}.z = zDataSurface;
- obj.data{projectionIndex}.colorscale = colorScale;
- obj.data{projectionIndex}.hidesurface = true;
- obj.data{projectionIndex}.surfacecolor = zDataSurface;
- obj.data{projectionIndex}.showscale = false;
+ obj.data{projectionIndex}.colorscale = colorScale;
+ obj.data{projectionIndex}.hidesurface = true;
+ obj.data{projectionIndex}.surfacecolor = zDataSurface;
+ obj.data{projectionIndex}.showscale = false;
- obj.data{projectionIndex}.contours.z.show = true;
- obj.data{projectionIndex}.contours.z.width = 15;
- obj.data{projectionIndex}.contours.z.usecolormap = true;
- obj.data{projectionIndex}.contours.z.project.z = true;
-end
+ obj.data{projectionIndex}.contours.z.show = true;
+ obj.data{projectionIndex}.contours.z.width = 15;
+ obj.data{projectionIndex}.contours.z.usecolormap = true;
+ obj.data{projectionIndex}.contours.z.project.z = true;
+ end
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-SCENE CONFIGUTATION-%
+ %-SCENE CONFIGUTATION-%
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-aspect ratio-%
-asr = obj.PlotOptions.AspectRatio;
+ %-aspect ratio-%
+ asr = obj.PlotOptions.AspectRatio;
-if ~isempty(asr)
- if ischar(asr)
- scene.aspectmode = asr;
- elseif isvector(ar) && length(asr) == 3
- xar = asr(1);
- yar = asr(2);
- zar = asr(3);
- end
-else
+ if ~isempty(asr)
+ if ischar(asr)
+ scene.aspectmode = asr;
+ elseif isvector(ar) && length(asr) == 3
+ xar = asr(1);
+ yar = asr(2);
+ zar = asr(3);
+ end
+ else
- %-define as default-%
- xar = max(xData(:));
- yar = max(yData(:));
- xyar = max([xar, yar]);
- zar = 0.75*xyar;
-end
+ %-define as default-%
+ xar = max(xData(:));
+ yar = max(yData(:));
+ xyar = max([xar, yar]);
+ zar = 0.75*xyar;
+ end
-scene.aspectratio.x = 1.1*xyar;
-scene.aspectratio.y = 1.0*xyar;
-scene.aspectratio.z = zar;
+ scene.aspectratio.x = 1.1*xyar;
+ scene.aspectratio.y = 1.0*xyar;
+ scene.aspectratio.z = zar;
-%---------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-camera eye-%
-ey = obj.PlotOptions.CameraEye;
+ %-camera eye-%
+ ey = obj.PlotOptions.CameraEye;
-if ~isempty(ey)
- if isvector(ey) && length(ey) == 3
- scene.camera.eye.x = ey(1);
- scene.camera.eye.y = ey(2);
- scene.camera.eye.z = ey(3);
+ if ~isempty(ey)
+ if isvector(ey) && length(ey) == 3
+ scene.camera.eye.x = ey(1);
+ scene.camera.eye.y = ey(2);
+ scene.camera.eye.z = ey(3);
+ end
+ else
+ %-define as default-%
+ xey = - xyar; if xey>0 xfac = -0.0; else xfac = 0.0; end
+ yey = - xyar; if yey>0 yfac = -0.3; else yfac = 0.3; end
+ if zar>0 zfac = 0.1; else zfac = -0.1; end
+
+ scene.camera.eye.x = xey + xfac*xey;
+ scene.camera.eye.y = yey + yfac*yey;
+ scene.camera.eye.z = zar + zfac*zar;
end
-else
-
- %-define as default-%
- xey = - xyar; if xey>0 xfac = 0.0; else xfac = 0.0; end
- yey = - xyar; if yey>0 yfac = -0.3; else yfac = 0.3; end
- if zar>0 zfac = 0.1; else zfac = -0.1; end
-
- scene.camera.eye.x = xey + xfac*xey;
- scene.camera.eye.y = yey + yfac*yey;
- scene.camera.eye.z = zar + zfac*zar;
-end
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-scene axis configuration-%
+ %-scene axis configuration-%
-scene.xaxis.range = axisData.XLim;
-scene.yaxis.range = axisData.YLim;
-scene.zaxis.range = axisData.ZLim;
+ scene.xaxis.range = axisData.XLim;
+ scene.yaxis.range = axisData.YLim;
+ scene.zaxis.range = axisData.ZLim;
-scene.xaxis.tickvals = axisData.XTick;
-scene.xaxis.ticktext = axisData.XTickLabel;
+ scene.xaxis.tickvals = axisData.XTick;
+ scene.xaxis.ticktext = axisData.XTickLabel;
-scene.yaxis.tickvals = axisData.YTick;
-scene.yaxis.ticktext = axisData.YTickLabel;
+ scene.yaxis.tickvals = axisData.YTick;
+ scene.yaxis.ticktext = axisData.YTickLabel;
-scene.zaxis.tickvals = axisData.ZTick;
-scene.zaxis.ticktext = axisData.ZTickLabel;
+ scene.zaxis.tickvals = axisData.ZTick;
+ scene.zaxis.ticktext = axisData.ZTickLabel;
-scene.xaxis.zeroline = false;
-scene.yaxis.zeroline = false;
-scene.zaxis.zeroline = false;
+ scene.xaxis.zeroline = false;
+ scene.yaxis.zeroline = false;
+ scene.zaxis.zeroline = false;
-scene.xaxis.showline = true;
-scene.yaxis.showline = true;
-scene.zaxis.showline = true;
+ scene.xaxis.showline = true;
+ scene.yaxis.showline = true;
+ scene.zaxis.showline = true;
-scene.xaxis.tickcolor = 'rgba(0,0,0,1)';
-scene.yaxis.tickcolor = 'rgba(0,0,0,1)';
-scene.zaxis.tickcolor = 'rgba(0,0,0,1)';
+ scene.xaxis.tickcolor = 'rgba(0,0,0,1)';
+ scene.yaxis.tickcolor = 'rgba(0,0,0,1)';
+ scene.zaxis.tickcolor = 'rgba(0,0,0,1)';
-scene.xaxis.ticklabelposition = 'outside';
-scene.yaxis.ticklabelposition = 'outside';
-scene.zaxis.ticklabelposition = 'outside';
+ scene.xaxis.ticklabelposition = 'outside';
+ scene.yaxis.ticklabelposition = 'outside';
+ scene.zaxis.ticklabelposition = 'outside';
-scene.xaxis.title = axisData.XLabel.String;
-scene.yaxis.title = axisData.YLabel.String;
-scene.zaxis.title = axisData.ZLabel.String;
+ scene.xaxis.title = axisData.XLabel.String;
+ scene.yaxis.title = axisData.YLabel.String;
+ scene.zaxis.title = axisData.ZLabel.String;
-scene.xaxis.tickfont.size = axisData.FontSize;
-scene.yaxis.tickfont.size = axisData.FontSize;
-scene.zaxis.tickfont.size = axisData.FontSize;
+ scene.xaxis.tickfont.size = axisData.FontSize;
+ scene.yaxis.tickfont.size = axisData.FontSize;
+ scene.zaxis.tickfont.size = axisData.FontSize;
-scene.xaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
-scene.yaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
-scene.zaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
+ scene.xaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
+ scene.yaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
+ scene.zaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-SET SCENE TO LAYOUT-%
-obj.layout = setfield(obj.layout, sprintf('scene%d', xsource), scene);
+ %-SET SCENE TO LAYOUT-%
+ obj.layout = setfield(obj.layout, sprintf('scene%d', xsource), scene);
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-surface name-%
-obj.data{surfaceIndex}.name = meshData.DisplayName;
-obj.data{contourIndex}.name = meshData.DisplayName;
+ %-surface name-%
+ obj.data{surfaceIndex}.name = meshData.DisplayName;
+ obj.data{contourIndex}.name = meshData.DisplayName;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-surface showscale-%
-obj.data{surfaceIndex}.showscale = false;
-obj.data{contourIndex}.showscale = false;
+ %-surface showscale-%
+ obj.data{surfaceIndex}.showscale = false;
+ obj.data{contourIndex}.showscale = false;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-surface visible-%
-obj.data{surfaceIndex}.visible = strcmp(meshData.Visible,'on');
-obj.data{contourIndex}.visible = strcmp(meshData.Visible,'on');
+ %-surface visible-%
+ obj.data{surfaceIndex}.visible = strcmp(meshData.Visible,'on');
+ obj.data{contourIndex}.visible = strcmp(meshData.Visible,'on');
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-leg = meshData.Annotation;
-legInfo = leg.LegendInformation;
+ leg = meshData.Annotation;
+ legInfo = leg.LegendInformation;
-switch legInfo.IconDisplayStyle
- case 'on'
- showleg = true;
- case 'off'
- showleg = false;
-end
-
-obj.data{surfaceIndex}.showlegend = showleg;
-
-%-------------------------------------------------------------------------%
+ switch legInfo.IconDisplayStyle
+ case 'on'
+ showleg = true;
+ case 'off'
+ showleg = false;
+ end
+ obj.data{surfaceIndex}.showlegend = showleg;
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateGeoPlot.m b/plotly/plotlyfig_aux/handlegraphics/updateGeoPlot.m
index 0d69d819..17702c20 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateGeoPlot.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateGeoPlot.m
@@ -1,7 +1,4 @@
function updateGeoPlot(obj,geoIndex)
-
- %-----------------------------------------------------------------------------%
-
%-INTIALIZATIONS-%
axIndex = obj.getAxisIndex(obj.State.Plot(geoIndex).AssociatedAxis);
@@ -9,13 +6,12 @@ function updateGeoPlot(obj,geoIndex)
axisData = geoData.Parent;
[xSource, ~] = findSourceAxis(obj,axIndex);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set trace-%
if strcmpi(obj.PlotOptions.geoRenderType, 'geo')
obj.data{geoIndex}.geo = sprintf('geo%d', xSource+1);
obj.data{geoIndex}.type = 'scattergeo';
-
elseif strcmpi(obj.PlotOptions.geoRenderType, 'mapbox')
obj.data{geoIndex}.subplot = sprintf('mapbox%d', xSource+1);
obj.data{geoIndex}.type = 'scattermapbox';
@@ -23,13 +19,13 @@ function updateGeoPlot(obj,geoIndex)
obj.data{geoIndex}.mode = 'lines+markers';
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set trace data-%
obj.data{geoIndex}.lat = geoData.LatitudeData;
obj.data{geoIndex}.lon = geoData.LongitudeData;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set trace's marker and line-%
[marker, linee] = extractGeoLinePlusMarker(geoData, axisData);
@@ -41,7 +37,6 @@ function updateGeoPlot(obj,geoIndex)
if strcmpi(obj.PlotOptions.geoRenderType, 'mapbox')
marker.allowoverlap = true;
marker = rmfield(marker, 'symbol');
-
if strcmp(marker.color, 'rgba(0,0,0,0)') && isfield(marker, 'line')
marker.color = marker.line.color;
end
@@ -50,6 +45,4 @@ function updateGeoPlot(obj,geoIndex)
obj.data{geoIndex}.marker = marker;
obj.data{geoIndex}.line = linee;
-
- %-------------------------------------------------------------------------%
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateGeoScatter.m b/plotly/plotlyfig_aux/handlegraphics/updateGeoScatter.m
index 6391eee5..3b66ca31 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateGeoScatter.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateGeoScatter.m
@@ -1,7 +1,4 @@
function updateGeoScatter(obj,geoIndex)
-
- %-----------------------------------------------------------------------------%
-
%-INTIALIZATIONS-%
axIndex = obj.getAxisIndex(obj.State.Plot(geoIndex).AssociatedAxis);
@@ -9,13 +6,12 @@ function updateGeoScatter(obj,geoIndex)
axisData = geoData.Parent;
[xSource, ~] = findSourceAxis(obj,axIndex);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set trace-%
if strcmpi(obj.PlotOptions.geoRenderType, 'geo')
obj.data{geoIndex}.geo = sprintf('geo%d', xSource+1);
obj.data{geoIndex}.type = 'scattergeo';
-
elseif strcmpi(obj.PlotOptions.geoRenderType, 'mapbox')
obj.data{geoIndex}.subplot = sprintf('mapbox%d', xSource+1);
obj.data{geoIndex}.type = 'scattermapbox';
@@ -23,13 +19,13 @@ function updateGeoScatter(obj,geoIndex)
obj.data{geoIndex}.mode = 'markers+text';
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set trace data-%
obj.data{geoIndex}.lat = geoData.LatitudeData;
obj.data{geoIndex}.lon = geoData.LongitudeData;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set trace marker-%
marker = extractGeoMarker(geoData, axisData);
@@ -37,13 +33,10 @@ function updateGeoScatter(obj,geoIndex)
if strcmpi(obj.PlotOptions.geoRenderType, 'mapbox')
marker.allowoverlap = true;
marker = rmfield(marker, 'symbol');
-
if strcmp(marker.color, 'rgba(0,0,0,0)') && isfield(marker, 'line')
marker.color = marker.line.color;
end
end
obj.data{geoIndex}.marker = marker;
-
- %-------------------------------------------------------------------------%
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateGeobubble.m b/plotly/plotlyfig_aux/handlegraphics/updateGeobubble.m
index 3ac00953..af8bd4b6 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateGeobubble.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateGeobubble.m
@@ -1,7 +1,4 @@
function updateGeobubble(obj,geoIndex)
-
- %-----------------------------------------------------------------------------%
-
%-INTIALIZATIONS-%
axIndex = obj.getAxisIndex(obj.State.Plot(geoIndex).AssociatedAxis);
@@ -18,13 +15,12 @@ function updateGeobubble(obj,geoIndex)
if ~isempty(geoData.ColorData)
allNames = geoData.ColorData;
-
+
[groupNames, ~, allNamesIdx] = unique(allNames);
nGroups = length(groupNames);
byGroups = true;
for g=1:nGroups
-
idx = g == allNamesIdx;
group{g} = char(groupNames(g));
@@ -37,9 +33,7 @@ function updateGeobubble(obj,geoIndex)
lon{g} = [allLons(idx); NaN; NaN];
sData{g} = [allSizes(idx); NaN; NaN];
end
-
end
-
else
lat{1} = allLats;
lon{1} = allLons;
@@ -48,18 +42,13 @@ function updateGeobubble(obj,geoIndex)
byGroups = false;
end
- %-----------------------------------------------------------------------------%
-
- %=============================================================================%
+ %=====================================================================%
%
%-SET TRACES-%
%
- %=============================================================================%
+ %=====================================================================%
for g = 1:nGroups
-
- %-------------------------------------------------------------------------%
-
%-get current trace index-%
p = geoIndex;
@@ -68,7 +57,7 @@ function updateGeobubble(obj,geoIndex)
p = obj.PlotOptions.nPlots;
end
- %-------------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-set current trace-%
if strcmpi(obj.PlotOptions.geoRenderType, 'geo')
@@ -82,13 +71,13 @@ function updateGeobubble(obj,geoIndex)
obj.data{p}.mode = 'markers';
- %-------------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-set current trace data-%
obj.data{p}.lat = lat{g};
obj.data{p}.lon = lon{g};
- %-------------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-set trace marker-%
marker = struct();
@@ -98,7 +87,7 @@ function updateGeobubble(obj,geoIndex)
obj.data{p}.marker = marker;
- %-------------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-legend-%
if byGroups
@@ -106,16 +95,13 @@ function updateGeobubble(obj,geoIndex)
obj.data{p}.legendgroup = obj.data{p}.name;
obj.data{p}.showlegend = true;
end
-
- %-------------------------------------------------------------------------%
-
end
- %=============================================================================%
+ %=====================================================================%
%
%-UPDATE GEO AXES-%
%
- %=============================================================================%
+ %=====================================================================%
%-set domain plot-%
xo = geoData.Position(1);
@@ -126,14 +112,14 @@ function updateGeobubble(obj,geoIndex)
geoaxes.domain.x = min([xo xo + w],1);
geoaxes.domain.y = min([yo yo + h],1);
- %-----------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-setting projection-%
if strcmpi(obj.PlotOptions.geoRenderType, 'geo')
geoaxes.projection.type = 'mercator';
end
- %-----------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-setting basemap-%
if strcmpi(obj.PlotOptions.geoRenderType, 'geo')
@@ -154,7 +140,7 @@ function updateGeobubble(obj,geoIndex)
geoaxes.showland = true;
end
- %-----------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-setting latitude axis-%
if strcmpi(obj.PlotOptions.geoRenderType, 'geo')
@@ -167,7 +153,7 @@ function updateGeobubble(obj,geoIndex)
end
end
- %-----------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-setting longitude axis-%
if strcmpi(obj.PlotOptions.geoRenderType, 'geo')
@@ -180,20 +166,20 @@ function updateGeobubble(obj,geoIndex)
end
end
- %-----------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set map center-%
geoaxes.center.lat = geoData.MapCenter(1);
geoaxes.center.lon = geoData.MapCenter(2);
- %-----------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set better resolution-%
if strcmpi(obj.PlotOptions.geoRenderType, 'geo')
geo.resolution = '50';
end
- %-----------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set mapbox style-%
if strcmpi(obj.PlotOptions.geoRenderType, 'mapbox')
@@ -206,7 +192,7 @@ function updateGeobubble(obj,geoIndex)
end
end
- %-----------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set geo geoaxes to layout-%
if strcmpi(obj.PlotOptions.geoRenderType, 'geo')
@@ -215,14 +201,14 @@ function updateGeobubble(obj,geoIndex)
obj.layout = setfield(obj.layout, sprintf('mapbox%d', xSource+1), geoaxes);
end
- %-----------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-remove any annotation text-%
istitle = length(geoData.Title) > 0;
obj.layout.annotations{1}.text = ' ';
obj.layout.annotations{1}.showarrow = false;
- %-----------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-layout title-%
if istitle
@@ -238,7 +224,7 @@ function updateGeobubble(obj,geoIndex)
obj.layout.annotations{1}.font.size = 1.5*geoData.FontSize;
end
- %-----------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-setting legend-%
if byGroups
@@ -272,6 +258,4 @@ function updateGeobubble(obj,geoIndex)
obj.layout.legend.traceorder = 'normal';
obj.layout.legend.valign = 'middle';
end
-
- %-----------------------------------------------------------------------------%
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateHeatmap.m b/plotly/plotlyfig_aux/handlegraphics/updateHeatmap.m
index 11126161..f953448a 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateHeatmap.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateHeatmap.m
@@ -1,111 +1,103 @@
function obj = updateHeatmap(obj,heatIndex)
+ %-HEATMAP DATA STRUCTURE- %
+ heat_data = obj.State.Plot(heatIndex).Handle;
-%-------------------------------------------------------------------------%
+ %-CHECK FOR MULTIPLE AXES-%
+ [xsource, ysource] = findSourceAxis(obj,heatIndex);
-%-HEATMAP DATA STRUCTURE- %
-heat_data = obj.State.Plot(heatIndex).Handle;
+ %---------------------------------------------------------------------%
-%-CHECK FOR MULTIPLE AXES-%
-[xsource, ysource] = findSourceAxis(obj,heatIndex);
+ %-heatmap type-%
+ obj.data{heatIndex}.type = 'heatmap';
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-heatmap type-%
-obj.data{heatIndex}.type = 'heatmap';
+ %-format data-%
+ xdata = heat_data.XDisplayData;
+ ydata = heat_data.YDisplayData(end:-1:1, :);
+ cdata = heat_data.ColorDisplayData(end:-1:1, :);
-%-------------------------------------------------------------------------%
+ obj.data{heatIndex}.x = xdata;
+ obj.data{heatIndex}.y = ydata;
+ obj.data{heatIndex}.z = cdata;
+ obj.data{heatIndex}.connectgaps = false;
+ obj.data{heatIndex}.hoverongaps = false;
-%-format data-%
-xdata = heat_data.XDisplayData;
-ydata = heat_data.YDisplayData(end:-1:1, :);
-cdata = heat_data.ColorDisplayData(end:-1:1, :);
+ %---------------------------------------------------------------------%
-obj.data{heatIndex}.x = xdata;
-obj.data{heatIndex}.y = ydata;
-obj.data{heatIndex}.z = cdata;
-obj.data{heatIndex}.connectgaps = false;
-obj.data{heatIndex}.hoverongaps = false;
+ %-heatmap colorscale-%
+ cmap = heat_data.Colormap;
+ len = length(cmap)-1;
-%-------------------------------------------------------------------------%
-
-%-heatmap colorscale-%
-cmap = heat_data.Colormap;
-len = length(cmap)-1;
-
-for c = 1: length(cmap)
- col = 255 * cmap(c, :);
- obj.data{heatIndex}.colorscale{c} = { (c-1)/len , ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')' ] };
-end
-
-%-------------------------------------------------------------------------%
-
-%-setting plot-%
-obj.data{heatIndex}.hoverinfo = 'text';
-obj.data{heatIndex}.text = heat_data.ColorData(end:-1:1, :);
-obj.data{heatIndex}.hoverlabel.bgcolor = 'white';
-
-%-------------------------------------------------------------------------%
-
-%-show colorbar-%
-obj.data{heatIndex}.showscale = false;
-if strcmpi(heat_data.ColorbarVisible, 'on')
- obj.data{heatIndex}.showscale = true;
- obj.data{heatIndex}.colorbar.x = 0.87;
- obj.data{heatIndex}.colorbar.y = 0.52;
- obj.data{heatIndex}.colorbar.ypad = 55;
- obj.data{heatIndex}.colorbar.xpad = obj.PlotlyDefaults.MarginPad;
- obj.data{heatIndex}.colorbar.outlinecolor = 'rgb(150,150,150)';
-end
-
-%-------------------------------------------------------------------------%
-
-%-hist visible-%
-obj.data{heatIndex}.visible = strcmp(heat_data.Visible,'on');
-obj.data{heatIndex}.opacity = 0.95;
-
-%-------------------------------------------------------------------------%
+ for c = 1: length(cmap)
+ col = 255 * cmap(c, :);
+ obj.data{heatIndex}.colorscale{c} = ...
+ { (c-1)/len, sprintf("rgb(%f,%f,%f)", col)};
+ end
-%-setting annotation text-%
-c = 1;
-maxcol = max(cdata(:));
+ %---------------------------------------------------------------------%
-for n = 1:size(cdata, 2)
- for m = 1:size(cdata, 1)
+ %-setting plot-%
+ obj.data{heatIndex}.hoverinfo = 'text';
+ obj.data{heatIndex}.text = heat_data.ColorData(end:-1:1, :);
+ obj.data{heatIndex}.hoverlabel.bgcolor = 'white';
- %-text-%
- ann{c}.text = num2str(round(cdata(m,n), 2));
- ann{c}.x = n-1;
- ann{c}.y = m-1;
- ann{c}.showarrow = false;
+ %---------------------------------------------------------------------%
- %-font-%
- ann{c}.font.size = heat_data.FontSize*1.15;
- ann{c}.font.family = matlab2plotlyfont(heat_data.FontName);
+ %-show colorbar-%
+ obj.data{heatIndex}.showscale = false;
+ if strcmpi(heat_data.ColorbarVisible, 'on')
+ obj.data{heatIndex}.showscale = true;
+ obj.data{heatIndex}.colorbar.x = 0.87;
+ obj.data{heatIndex}.colorbar.y = 0.52;
+ obj.data{heatIndex}.colorbar.ypad = 55;
+ obj.data{heatIndex}.colorbar.xpad = obj.PlotlyDefaults.MarginPad;
+ obj.data{heatIndex}.colorbar.outlinecolor = 'rgb(150,150,150)';
+ end
- if cdata(m,n) < 0.925*maxcol
- col = [0,0,0];
- else
- col = [255,255,255];
+ %---------------------------------------------------------------------%
+
+ %-hist visible-%
+ obj.data{heatIndex}.visible = strcmp(heat_data.Visible,'on');
+ obj.data{heatIndex}.opacity = 0.95;
+
+ %---------------------------------------------------------------------%
+
+ %-setting annotation text-%
+ c = 1;
+ maxcol = max(cdata(:));
+
+ for n = 1:size(cdata, 2)
+ for m = 1:size(cdata, 1)
+ %-text-%
+ ann{c}.text = num2str(round(cdata(m,n), 2));
+ ann{c}.x = n-1;
+ ann{c}.y = m-1;
+ ann{c}.showarrow = false;
+
+ %-font-%
+ ann{c}.font.size = heat_data.FontSize*1.15;
+ ann{c}.font.family = matlab2plotlyfont(heat_data.FontName);
+ if cdata(m,n) < 0.925*maxcol
+ col = [0,0,0];
+ else
+ col = [255,255,255];
+ end
+ ann{c}.font.color = sprintf('rgb(%f,%f,%f)', col);
+ c = c+1;
end
-
- ann{c}.font.color = sprintf('rgb(%f,%f,%f)', col);
-
- c = c+1;
end
-end
-
-%-------------------------------------------------------------------------%
-%-set annotations to layout-%
-obj.layout = setfield(obj.layout, 'annotations', ann);
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-set annotations to layout-%
+ obj.layout = setfield(obj.layout, 'annotations', ann);
-%-set backgroud color if any NaN in cdata-%
-if any(isnan(cdata(:)))
- obj.layout.plot_bgcolor = 'rgb(40,40,40)';
- obj.data{heatIndex}.opacity = 1;
-end
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-set backgroud color if any NaN in cdata-%
+ if any(isnan(cdata(:)))
+ obj.layout.plot_bgcolor = 'rgb(40,40,40)';
+ obj.data{heatIndex}.opacity = 1;
+ end
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateHistogram2.m b/plotly/plotlyfig_aux/handlegraphics/updateHistogram2.m
index de2f8fc5..ee82a84d 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateHistogram2.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateHistogram2.m
@@ -1,7 +1,4 @@
function obj = updateHistogram2(obj,dataIndex)
-
- %--------------------------------------------------------------------------%
-
%-INITIALIZATIONS-%
axIndex = obj.getAxisIndex(obj.State.Plot(dataIndex).AssociatedAxis);
@@ -29,14 +26,18 @@
if isinf(yEdges(end)) yEdges(end) = yEdges(end-1) + dy(1); end
[xData, yData, zData, iData, jData, kData] = ...
- getPlotlyMesh3d( xEdges, yEdges, values, barGap );
+ getPlotlyMesh3d( xEdges, yEdges, values, barGap );
- if strcmp(plotData.ShowEmptyBins, 'on'), zData = zData-1; end
+ if strcmp(plotData.ShowEmptyBins, 'on')
+ zData = zData-1;
+ end
cData = zeros(size(zData));
- for n = 1:2:length(zData), cData(n:n+1) = max(zData(n:n+1)); end
+ for n = 1:2:length(zData)
+ cData(n:n+1) = max(zData(n:n+1));
+ end
- %--------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set trace-%
updateScene(obj, dataIndex);
@@ -47,7 +48,7 @@
obj.data{dataIndex}.visible = strcmp(plotData.Visible,'on');
obj.layout.bargap = barGap;
- %--------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set trace data-%
obj.data{dataIndex}.x = xData;
@@ -57,7 +58,7 @@
obj.data{dataIndex}.j = int16(jData - 1);
obj.data{dataIndex}.k = int16(kData - 1);
- %--------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set trace coloring-%
faceColor = plotData.FaceColor;
@@ -87,13 +88,11 @@
obj.data{dataIndex}.lighting.diffuse = 0.92;
obj.data{dataIndex}.lighting.ambient = 0.92;
end
-
- %--------------------------------------------------------------------------%
end
function updateScene(obj, dataIndex)
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-INITIALIZATIONS-%
@@ -124,7 +123,7 @@ function updateScene(obj, dataIndex)
cameraEye = cameraEye / eyeNorm;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-aspect ratio-%
scene.aspectratio.x = aspectRatio(1);
@@ -141,7 +140,7 @@ function updateScene(obj, dataIndex)
scene.camera.up.y = cameraUpVector(2);
scene.camera.up.z = cameraUpVector(3);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-get each scene axis-%
scene.xaxis = getSceneAxis(axisData, 'X');
@@ -152,16 +151,13 @@ function updateScene(obj, dataIndex)
scene.zaxis.visible = false;
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-SET SCENE TO LAYOUT-%
obj.layout = setfield(obj.layout, sprintf('scene%d', xSource), scene);
-
- %-------------------------------------------------------------------------%
end
function ax = getSceneAxis(axisData, axName)
-
%-initializations-%
axx = axisData.(axName + "Axis");
ax.zeroline = false;
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateHistogramPolar.m b/plotly/plotlyfig_aux/handlegraphics/updateHistogramPolar.m
index 93c9d09c..b29282f1 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateHistogramPolar.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateHistogramPolar.m
@@ -1,118 +1,114 @@
function obj = updateHistogramPolar(obj,histIndex)
+ % x:...[DONE]
+ % y:...[DONE]
+ % histnorm:...[DONE]
+ % name:...[DONE]
+ % autobinx:...[DONE]
+ % nbinsx:...[DONE]
+ % xbins:...[DONE]
+ % autobiny:...[DONE]
+ % nbinsy:...[DONE]
+ % ybins:...[DONE]
+ % text:...[NOT SUPPORTED IN MATLAB]
+ % error_y:...[HANDLED BY ERRORBARSERIES]
+ % error_x:...[HANDLED BY ERRORBARSERIES]
+ % opacity: --- [TODO]
+ % xaxis:...[DONE]
+ % yaxis:...[DONE]
+ % showlegend:...[DONE]
+ % stream:...[HANDLED BY PLOTLYSTREAM]
+ % visible:...[DONE]
+ % type:...[DONE]
+ % orientation:...[DONE]
+
+ % MARKER:
+ % color: ...[DONE]
+ % size: ...[NA]
+ % symbol: ...[NA]
+ % opacity: ...[TODO]
+ % sizeref: ...[NA]
+ % sizemode: ...[NA]
+ % colorscale: ...[NA]
+ % cauto: ...[NA]
+ % cmin: ...[NA]
+ % cmax: ...[NA]
+ % outliercolor: ...[NA]
+ % maxdisplayed: ...[NA]
+
+ % MARKER LINE:
+ % color: ...[DONE]
+ % width: ...[DONE]
+ % dash: ...[NA]
+ % opacity: ...[TODO]
+ % shape: ...[NA]
+ % smoothing: ...[NA]
+ % outliercolor: ...[NA]
+ % outlierwidth: ...[NA]
+
+ %---------------------------------------------------------------------%
+
+ %-AXIS INDEX-%
+ axIndex = obj.getAxisIndex(obj.State.Plot(histIndex).AssociatedAxis);
+
+ %-HIST DATA STRUCTURE- %
+ hist_data = obj.State.Plot(histIndex).Handle;
+
+ %---------------------------------------------------------------------%
+
+ %-barpolar type-%
+ obj.data{histIndex}.type = 'barpolar';
+
+ %---------------------------------------------------------------------%
+
+ %-barpolar data-%
+ binedges = rad2deg(hist_data.BinEdges);
+ obj.data{histIndex}.theta = binedges(1:end-1) + 0.5*diff(binedges);
+ obj.data{histIndex}.width = diff(binedges);
+ obj.data{histIndex}.r = double(hist_data.BinCounts);
+
+ %---------------------------------------------------------------------%
+
+ %-hist name-%
+ obj.data{histIndex}.name = hist_data.DisplayName;
+
+ %---------------------------------------------------------------------%
+
+ %-layout barmode-%
+ obj.layout.barmode = 'group';
+
+ %---------------------------------------------------------------------%
+
+ %-hist line width-%
+ obj.data{histIndex}.marker.line.width = hist_data.LineWidth;
+
+ %---------------------------------------------------------------------%
+
+ %-hist opacity-%
+ if ~ischar(hist_data.FaceAlpha)
+ obj.data{histIndex}.opacity = hist_data.FaceAlpha;
+ end
+
+ %---------------------------------------------------------------------%
+
+ obj.data{histIndex}.marker = extractPatchFace(hist_data);
+
+ %---------------------------------------------------------------------%
+
+ %-hist visible-%
+ obj.data{histIndex}.visible = strcmp(hist_data.Visible,'on');
+
+ %---------------------------------------------------------------------%
+
+ %-hist showlegend-%
+ leg = hist_data.Annotation;
+ legInfo = leg.LegendInformation;
+
+ switch legInfo.IconDisplayStyle
+ case 'on'
+ showleg = true;
+ case 'off'
+ showleg = false;
+ end
-% x:...[DONE]
-% y:...[DONE]
-% histnorm:...[DONE]
-% name:...[DONE]
-% autobinx:...[DONE]
-% nbinsx:...[DONE]
-% xbins:...[DONE]
-% autobiny:...[DONE]
-% nbinsy:...[DONE]
-% ybins:...[DONE]
-% text:...[NOT SUPPORTED IN MATLAB]
-% error_y:...[HANDLED BY ERRORBARSERIES]
-% error_x:...[HANDLED BY ERRORBARSERIES]
-% opacity: --- [TODO]
-% xaxis:...[DONE]
-% yaxis:...[DONE]
-% showlegend:...[DONE]
-% stream:...[HANDLED BY PLOTLYSTREAM]
-% visible:...[DONE]
-% type:...[DONE]
-% orientation:...[DONE]
-
-% MARKER:
-% color: ...[DONE]
-% size: ...[NA]
-% symbol: ...[NA]
-% opacity: ...[TODO]
-% sizeref: ...[NA]
-% sizemode: ...[NA]
-% colorscale: ...[NA]
-% cauto: ...[NA]
-% cmin: ...[NA]
-% cmax: ...[NA]
-% outliercolor: ...[NA]
-% maxdisplayed: ...[NA]
-
-% MARKER LINE:
-% color: ...[DONE]
-% width: ...[DONE]
-% dash: ...[NA]
-% opacity: ...[TODO]
-% shape: ...[NA]
-% smoothing: ...[NA]
-% outliercolor: ...[NA]
-% outlierwidth: ...[NA]
-
-%-------------------------------------------------------------------------%
-
-%-AXIS INDEX-%
-axIndex = obj.getAxisIndex(obj.State.Plot(histIndex).AssociatedAxis);
-
-%-HIST DATA STRUCTURE- %
-hist_data = obj.State.Plot(histIndex).Handle;
-
-%-------------------------------------------------------------------------%
-
-%-barpolar type-%
-obj.data{histIndex}.type = 'barpolar';
-
-%-------------------------------------------------------------------------%
-
-%-barpolar data-%
-binedges = rad2deg(hist_data.BinEdges);
-obj.data{histIndex}.theta = binedges(1:end-1) + 0.5*diff(binedges);
-obj.data{histIndex}.width = diff(binedges);
-obj.data{histIndex}.r = double(hist_data.BinCounts);
-
-%-------------------------------------------------------------------------%
-
-%-hist name-%
-obj.data{histIndex}.name = hist_data.DisplayName;
-
-%-------------------------------------------------------------------------%
-
-%-layout barmode-%
-obj.layout.barmode = 'group';
-
-%-------------------------------------------------------------------------%
-
-%-hist line width-%
-obj.data{histIndex}.marker.line.width = hist_data.LineWidth;
-
-%-------------------------------------------------------------------------%
-
-%-hist opacity-%
-if ~ischar(hist_data.FaceAlpha)
- obj.data{histIndex}.opacity = hist_data.FaceAlpha;
-end
-
-%-------------------------------------------------------------------------%
-
-obj.data{histIndex}.marker = extractPatchFace(hist_data);
-
-%-------------------------------------------------------------------------%
-
-%-hist visible-%
-obj.data{histIndex}.visible = strcmp(hist_data.Visible,'on');
-
-%-------------------------------------------------------------------------%
-
-%-hist showlegend-%
-leg = hist_data.Annotation;
-legInfo = leg.LegendInformation;
-
-switch legInfo.IconDisplayStyle
- case 'on'
- showleg = true;
- case 'off'
- showleg = false;
-end
-
-obj.data{histIndex}.showlegend = showleg;
-
-%-------------------------------------------------------------------------%
-
+ obj.data{histIndex}.showlegend = showleg;
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateImage.m b/plotly/plotlyfig_aux/handlegraphics/updateImage.m
index c2a624bd..ae233158 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateImage.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateImage.m
@@ -1,181 +1,155 @@
function obj = updateImage(obj, imageIndex)
+ % HEATMAPS
+ % z: ...[DONE]
+ % x: ...[DONE]
+ % y: ...[DONE]
+ % name: ...[DONE]
+ % zauto: ...[DONE]
+ % zmin: ...[DONE]
+ % zmax: ...[DONE]
+ % colorscale: ...[DONE]
+ % reversescale: ...[DONE]
+ % showscale: ...[DONE]
+ % colorbar: ...[HANDLED BY COLORBAR]
+ % zsmooth: ...[NOT SUPPORTED BY MATLAB]
+ % opacity: ---[TODO]
+ % xaxis: ...[DONE]
+ % yaxis: ...[DONE]
+ % showlegend: ...[DONE]
+ % stream: ...[HANDLED BY PLOTLYSTREAM]
+ % visible: ...[DONE]
+ % x0: ...[NOT SUPPORTED IN MATLAB]
+ % dx: ...[NOT SUPPORTED IN MATLAB]
+ % y0: ...[NOT SUPPORTED IN MATLAB]
+ % dy: ...[NOT SUPPORTED IN MATLAB]
+ % xtype: ...[NOT SUPPORTED IN MATLAB]
+ % ytype: ...[NOT SUPPORTED IN MATLAB]
+ % type: ...[DONE]
+
+ %-FIGURE STRUCTURE-%
+ figure_data = obj.State.Figure.Handle;
+
+ %-AXIS STRUCTURE-%
+ axis_data = obj.State.Plot(imageIndex).AssociatedAxis;
+
+ %-AXIS INDEX-%
+ axIndex = obj.getAxisIndex(obj.State.Plot(imageIndex).AssociatedAxis);
+
+ %-CHECK FOR MULTIPLE AXES-%
+ [xsource, ysource] = findSourceAxis(obj,axIndex);
+
+ %-IMAGE DATA STRUCTURE- %
+ image_data = obj.State.Plot(imageIndex).Handle;
+
+ %-AXIS DATA-%
+ xaxis = obj.layout.("xaxis" + xsource);
+ yaxis = obj.layout.("yaxis" + ysource);
+
+ %---------------------------------------------------------------------%
+
+ %-image xaxis and yaxis-%
+ obj.data{imageIndex}.xaxis = ['x' num2str(xsource)];
+ obj.data{imageIndex}.yaxis = ['y' num2str(ysource)];
+
+ %---------------------------------------------------------------------%
+
+ %-image type-%
+ obj.data{imageIndex}.type = 'heatmap';
+
+ %---------------------------------------------------------------------%
+
+ %-image x-%
+ x = image_data.XData;
+ cdata = image_data.CData;
+
+ if (size(image_data.XData,2) == 2)
+ obj.data{imageIndex}.x = linspace(x(1), x(2), size(cdata,2));
+ else
+ obj.data{imageIndex}.x = image_data.XData;
+ end
-% HEATMAPS
-% z: ...[DONE]
-% x: ...[DONE]
-% y: ...[DONE]
-% name: ...[DONE]
-% zauto: ...[DONE]
-% zmin: ...[DONE]
-% zmax: ...[DONE]
-% colorscale: ...[DONE]
-% reversescale: ...[DONE]
-% showscale: ...[DONE]
-% colorbar: ...[HANDLED BY COLORBAR]
-% zsmooth: ...[NOT SUPPORTED BY MATLAB]
-% opacity: ---[TODO]
-% xaxis: ...[DONE]
-% yaxis: ...[DONE]
-% showlegend: ...[DONE]
-% stream: ...[HANDLED BY PLOTLYSTREAM]
-% visible: ...[DONE]
-% x0: ...[NOT SUPPORTED IN MATLAB]
-% dx: ...[NOT SUPPORTED IN MATLAB]
-% y0: ...[NOT SUPPORTED IN MATLAB]
-% dy: ...[NOT SUPPORTED IN MATLAB]
-% xtype: ...[NOT SUPPORTED IN MATLAB]
-% ytype: ...[NOT SUPPORTED IN MATLAB]
-% type: ...[DONE]
-
-%-FIGURE STRUCTURE-%
-figure_data = obj.State.Figure.Handle;
-
-%-AXIS STRUCTURE-%
-axis_data = obj.State.Plot(imageIndex).AssociatedAxis;
-
-%-AXIS INDEX-%
-axIndex = obj.getAxisIndex(obj.State.Plot(imageIndex).AssociatedAxis);
-
-%-CHECK FOR MULTIPLE AXES-%
-[xsource, ysource] = findSourceAxis(obj,axIndex);
-
-%-IMAGE DATA STRUCTURE- %
-image_data = obj.State.Plot(imageIndex).Handle;
-
-%-AXIS DATA-%
-xaxis = obj.layout.("xaxis" + xsource);
-yaxis = obj.layout.("yaxis" + ysource);
-
-%-------------------------------------------------------------------------%
-
-%-image xaxis-%
-obj.data{imageIndex}.xaxis = ['x' num2str(xsource)];
-
-%-------------------------------------------------------------------------%
-
-%-image yaxis-%
-obj.data{imageIndex}.yaxis = ['y' num2str(ysource)];
-
-%-------------------------------------------------------------------------%
-
-%-image type-%
-obj.data{imageIndex}.type = 'heatmap';
-
-%-------------------------------------------------------------------------%
-
-%-image x-%
-x = image_data.XData;
-cdata = image_data.CData;
-
-if (size(image_data.XData,2) == 2)
- obj.data{imageIndex}.x = linspace(x(1), x(2), size(cdata,2));
-else
- obj.data{imageIndex}.x = image_data.XData;
-end
-
-%-------------------------------------------------------------------------%
-
-%-image y-%
-y = image_data.YData;
-
-if (size(image_data.YData,2) == 2)
- obj.data{imageIndex}.y = linspace(y(1), y(2), size(cdata,1));
-else
- obj.data{imageIndex}.y = y;
-end
-
-%-------------------------------------------------------------------------%
-
-%-image z-%
-isrgbimg = (size(image_data.CData,3) > 1);
-
-if isrgbimg
- [IND,colormap] = rgb2ind(cdata, 256);
- obj.data{imageIndex}.z = IND;
-else
- obj.data{imageIndex}.z = cdata;
-end
-
-%-------------------------------------------------------------------------%
-
-%-image name-%
-try
- obj.data{imageIndex}.name = image_data.DisplayName;
-catch
- obj.data{imageIndex}.name = '';
-end
-
-%-------------------------------------------------------------------------%
-
-%-set the opacity-%
-obj.data{imageIndex}.opacity = image_data.AlphaData;
-
-%-------------------------------------------------------------------------%
-
-%-image visible-%
-obj.data{imageIndex}.visible = strcmp(image_data.Visible,'on');
-
-%-------------------------------------------------------------------------%
-
-%-image showscale-%
-obj.data{imageIndex}.showscale = false;
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-image y-%
+ y = image_data.YData;
-%-image zauto-%
-obj.data{imageIndex}.zauto = false;
+ if (size(image_data.YData,2) == 2)
+ obj.data{imageIndex}.y = linspace(y(1), y(2), size(cdata,1));
+ else
+ obj.data{imageIndex}.y = y;
+ end
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-image zmin-%
-obj.data{imageIndex}.zmin = axis_data.CLim(1);
+ %-image z-%
+ isrgbimg = (size(image_data.CData,3) > 1);
-%-------------------------------------------------------------------------%
+ if isrgbimg
+ [IND,colormap] = rgb2ind(cdata, 256);
+ obj.data{imageIndex}.z = IND;
+ else
+ obj.data{imageIndex}.z = cdata;
+ end
-%-image zmax-%
-if ~strcmpi(image_data.CDataMapping, 'direct')
- obj.data{imageIndex}.zmax = axis_data.CLim(2);
-else
- obj.data{imageIndex}.zmax = 255;
-end
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-image name-%
+ try
+ obj.data{imageIndex}.name = image_data.DisplayName;
+ catch
+ obj.data{imageIndex}.name = '';
+ end
-%-COLORSCALE (ASSUMES IMAGE CDATAMAP IS 'SCALED')-%
+ %---------------------------------------------------------------------%
-%-image colorscale-%
+ obj.data{imageIndex}.opacity = image_data.AlphaData;
+ obj.data{imageIndex}.visible = strcmp(image_data.Visible,'on');
+ obj.data{imageIndex}.showscale = false;
+ obj.data{imageIndex}.zauto = false;
+ obj.data{imageIndex}.zmin = axis_data.CLim(1);
-if ~isrgbimg
- colormap = figure_data.Colormap;
-end
+ %---------------------------------------------------------------------%
-len = length(colormap) - 1;
+ %-image zmax-%
+ if ~strcmpi(image_data.CDataMapping, 'direct')
+ obj.data{imageIndex}.zmax = axis_data.CLim(2);
+ else
+ obj.data{imageIndex}.zmax = 255;
+ end
-for c = 1:size(colormap, 1)
- col = 255*(colormap(c,:));
- obj.data{imageIndex}.colorscale{c} = {(c-1)/len, ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')']};
-end
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-COLORSCALE (ASSUMES IMAGE CDATAMAP IS 'SCALED')-%
-%-image showlegend-%
-try
- leg = image_data.Annotation;
- legInfo = leg.LegendInformation;
+ %-image colorscale-%
- switch legInfo.IconDisplayStyle
- case 'on'
- showleg = true;
- case 'off'
- showleg = false;
+ if ~isrgbimg
+ colormap = figure_data.Colormap;
end
- obj.data{imageIndex}.showlegend = showleg;
-catch
- %TODO to future
-end
+ len = length(colormap) - 1;
-%-------------------------------------------------------------------------%
+ for c = 1:size(colormap, 1)
+ col = 255*(colormap(c,:));
+ obj.data{imageIndex}.colorscale{c} = ...
+ {(c-1)/len, sprintf("rgb(%f,%f,%f)", col)};
+ end
+ %---------------------------------------------------------------------%
+
+ %-image showlegend-%
+ try
+ leg = image_data.Annotation;
+ legInfo = leg.LegendInformation;
+ switch legInfo.IconDisplayStyle
+ case 'on'
+ showleg = true;
+ case 'off'
+ showleg = false;
+ end
+ obj.data{imageIndex}.showlegend = showleg;
+ catch
+ %TODO to future
+ end
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateImage3D.m b/plotly/plotlyfig_aux/handlegraphics/updateImage3D.m
index 4f2a48ef..6d322ba7 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateImage3D.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateImage3D.m
@@ -1,197 +1,167 @@
function obj = updateImage3D(obj, imageIndex)
-% AS SURFACE
-% z: ...[DONE]
-% x: ...[DONE]
-% y: ...[DONE]
-% name: ...[DONE]
-% zauto: ...[DONE]
-% zmin: ...[DONE]
-% zmax: ...[DONE]
-% colorscale: ...[DONE]
-% reversescale: ...[DONE]
-% showscale: ...[DONE]
-% colorbar: ...[HANDLED BY COLORBAR]
-% zsmooth: ...[NOT SUPPORTED BY MATLAB]
-% opacity: ---[TODO]
-% xaxis: ...[DONE]
-% yaxis: ...[DONE]
-% showlegend: ...[DONE]
-% stream: ...[HANDLED BY PLOTLYSTREAM]
-% visible: ...[DONE]
-% x0: ...[NOT SUPPORTED IN MATLAB]
-% dx: ...[NOT SUPPORTED IN MATLAB]
-% y0: ...[NOT SUPPORTED IN MATLAB]
-% dy: ...[NOT SUPPORTED IN MATLAB]
-% xtype: ...[NOT SUPPORTED IN MATLAB]
-% ytype: ...[NOT SUPPORTED IN MATLAB]
-% type: ...[DONE]
-
-%-FIGURE STRUCTURE-%
-figure_data = obj.State.Figure.Handle;
-
-%-AXIS STRUCTURE-%
-axis_data = obj.State.Plot(imageIndex).AssociatedAxis;
-
-%-AXIS INDEX-%
-axIndex = obj.getAxisIndex(obj.State.Plot(imageIndex).AssociatedAxis);
-
-%-CHECK FOR MULTIPLE AXES-%
-[xsource, ysource] = findSourceAxis(obj,axIndex);
-
-%-IMAGE DATA STRUCTURE- %
-image_data = obj.State.Plot(imageIndex).Handle;
-
-%-AXIS DATA-%
-xaxis = obj.layout.("xaxis" + xsource);
-yaxis = obj.layout.("yaxis" + ysource);
-
-%-------------------------------------------------------------------------%
-
-%-image xaxis-%
-obj.data{imageIndex}.xaxis = ['x' num2str(xsource)];
-
-%-------------------------------------------------------------------------%
-
-%-image yaxis-%
-obj.data{imageIndex}.yaxis = ['y' num2str(ysource)];
-
-%-------------------------------------------------------------------------%
-
-%-image type-%
-obj.data{imageIndex}.type = 'surface';
-
-%-------------------------------------------------------------------------%
-
-%-format x an y data-%
-x = image_data.XData;
-y = image_data.YData;
-cdata = image_data.CData;
-
-if isvector(x)
- if size(x,2) == 2
- x = linspace(x(1), x(2), size(cdata,2));
+ % AS SURFACE
+ % z: ...[DONE]
+ % x: ...[DONE]
+ % y: ...[DONE]
+ % name: ...[DONE]
+ % zauto: ...[DONE]
+ % zmin: ...[DONE]
+ % zmax: ...[DONE]
+ % colorscale: ...[DONE]
+ % reversescale: ...[DONE]
+ % showscale: ...[DONE]
+ % colorbar: ...[HANDLED BY COLORBAR]
+ % zsmooth: ...[NOT SUPPORTED BY MATLAB]
+ % opacity: ---[TODO]
+ % xaxis: ...[DONE]
+ % yaxis: ...[DONE]
+ % showlegend: ...[DONE]
+ % stream: ...[HANDLED BY PLOTLYSTREAM]
+ % visible: ...[DONE]
+ % x0: ...[NOT SUPPORTED IN MATLAB]
+ % dx: ...[NOT SUPPORTED IN MATLAB]
+ % y0: ...[NOT SUPPORTED IN MATLAB]
+ % dy: ...[NOT SUPPORTED IN MATLAB]
+ % xtype: ...[NOT SUPPORTED IN MATLAB]
+ % ytype: ...[NOT SUPPORTED IN MATLAB]
+ % type: ...[DONE]
+
+ %-FIGURE STRUCTURE-%
+ figure_data = obj.State.Figure.Handle;
+
+ %-AXIS STRUCTURE-%
+ axis_data = obj.State.Plot(imageIndex).AssociatedAxis;
+
+ %-AXIS INDEX-%
+ axIndex = obj.getAxisIndex(obj.State.Plot(imageIndex).AssociatedAxis);
+
+ %-CHECK FOR MULTIPLE AXES-%
+ [xsource, ysource] = findSourceAxis(obj,axIndex);
+
+ %-IMAGE DATA STRUCTURE- %
+ image_data = obj.State.Plot(imageIndex).Handle;
+
+ %-AXIS DATA-%
+ xaxis = obj.layout.("xaxis" + xsource);
+ yaxis = obj.layout.("yaxis" + ysource);
+
+ %---------------------------------------------------------------------%
+
+ %-image xaxis and yaxis-%
+ obj.data{imageIndex}.xaxis = ['x' num2str(xsource)];
+ obj.data{imageIndex}.yaxis = ['y' num2str(ysource)];
+
+ %---------------------------------------------------------------------%
+
+ %-image type-%
+ obj.data{imageIndex}.type = 'surface';
+
+ %---------------------------------------------------------------------%
+
+ %-format x an y data-%
+ x = image_data.XData;
+ y = image_data.YData;
+ cdata = image_data.CData;
+
+ if isvector(x)
+ if size(x,2) == 2
+ x = linspace(x(1), x(2), size(cdata,2));
+ end
+
+ if size(y,2) == 2
+ y = linspace(y(1), y(2), size(cdata,1));
+ end
+
+ [x, y] = meshgrid(x, y);
end
-
- if size(y,2) == 2
- y = linspace(y(1), y(2), size(cdata,1));
- end
-
- [x, y] = meshgrid(x, y);
-end
-
-%-------------------------------------------------------------------------%
-
-%-surface x-%
-obj.data{imageIndex}.x = x;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-surface x-%
-obj.data{imageIndex}.y = y;
-
-%-------------------------------------------------------------------------%
-
-%-surface z-%
-isrgbimg = (size(image_data.CData,3) > 1);
-
-if isrgbimg
- [IND,colormap] = rgb2ind(cdata, 256);
- obj.data{imageIndex}.z = IND;
-else
- obj.data{imageIndex}.z = zeros(size(cdata));
-end
-
-%-------------------------------------------------------------------------%
-
-%-surface coloring-%
-obj.data{imageIndex}.surfacecolor = cdata;
-
-%-------------------------------------------------------------------------%
-
-%-surface setting-%
-obj.layout.scene.aspectmode = 'cube';
-
-%-------------------------------------------------------------------------%
-
-%-image name-%
-try
- obj.data{imageIndex}.name = image_data.DisplayName;
-catch
- obj.data{imageIndex}.name = '';
-end
+ %-surface x and y-%
+ obj.data{imageIndex}.x = x;
+ obj.data{imageIndex}.y = y;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-set the opacity-%
-obj.data{imageIndex}.opacity = image_data.AlphaData;
+ %-surface z-%
+ isrgbimg = (size(image_data.CData,3) > 1);
-%-------------------------------------------------------------------------%
-
-%-image visible-%
-obj.data{imageIndex}.visible = strcmp(image_data.Visible,'on');
-
-%-------------------------------------------------------------------------%
-
-%-image showscale-%
-obj.data{imageIndex}.showscale = false;
-
-%-------------------------------------------------------------------------%
+ if isrgbimg
+ [IND,colormap] = rgb2ind(cdata, 256);
+ obj.data{imageIndex}.z = IND;
+ else
+ obj.data{imageIndex}.z = zeros(size(cdata));
+ end
-%-image zauto-%
-obj.data{imageIndex}.zauto = false;
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-surface coloring-%
+ obj.data{imageIndex}.surfacecolor = cdata;
-%-image zmin-%
-obj.data{imageIndex}.zmin = axis_data.CLim(1);
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-surface setting-%
+ obj.layout.scene.aspectmode = 'cube';
-%-image zmax-%
-if ~strcmpi(image_data.CDataMapping, 'direct')
- obj.data{imageIndex}.zmax = axis_data.CLim(2);
-else
- obj.data{imageIndex}.zmax = 255;
-end
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-image name-%
+ try
+ obj.data{imageIndex}.name = image_data.DisplayName;
+ catch
+ obj.data{imageIndex}.name = '';
+ end
-%-COLORSCALE (ASSUMES IMAGE CDATAMAP IS 'SCALED')-%
+ %---------------------------------------------------------------------%
-%-image colorscale-%
+ obj.data{imageIndex}.opacity = image_data.AlphaData;
+ obj.data{imageIndex}.visible = strcmp(image_data.Visible,'on');
+ obj.data{imageIndex}.showscale = false;
+ obj.data{imageIndex}.zauto = false;
+ obj.data{imageIndex}.zmin = axis_data.CLim(1);
-if ~isrgbimg
- colormap = figure_data.Colormap;
-end
+ %---------------------------------------------------------------------%
-len = length(colormap) - 1;
+ %-image zmax-%
+ if ~strcmpi(image_data.CDataMapping, 'direct')
+ obj.data{imageIndex}.zmax = axis_data.CLim(2);
+ else
+ obj.data{imageIndex}.zmax = 255;
+ end
-for c = 1:size(colormap, 1)
- col = 255*(colormap(c,:));
- obj.data{imageIndex}.colorscale{c} = {(c-1)/len, ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')']};
-end
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-COLORSCALE (ASSUMES IMAGE CDATAMAP IS 'SCALED')-%
-%-image showlegend-%
-try
- leg = image_data.Annotation;
- legInfo = leg.LegendInformation;
+ %-image colorscale-%
- switch legInfo.IconDisplayStyle
- case 'on'
- showleg = true;
- case 'off'
- showleg = false;
+ if ~isrgbimg
+ colormap = figure_data.Colormap;
end
- obj.data{imageIndex}.showlegend = showleg;
-catch
- %TODO to future
-end
+ len = length(colormap) - 1;
-%-------------------------------------------------------------------------%
+ for c = 1:size(colormap, 1)
+ col = 255*(colormap(c,:));
+ obj.data{imageIndex}.colorscale{c} = ...
+ {(c-1)/len, sprintf("rgb(%f,%f,%f)", col)};
+ end
+ %---------------------------------------------------------------------%
+
+ %-image showlegend-%
+ try
+ leg = image_data.Annotation;
+ legInfo = leg.LegendInformation;
+ switch legInfo.IconDisplayStyle
+ case 'on'
+ showleg = true;
+ case 'off'
+ showleg = false;
+ end
+ obj.data{imageIndex}.showlegend = showleg;
+ catch
+ %TODO to future
+ end
end
-
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateImplicitFunctionSurface.m b/plotly/plotlyfig_aux/handlegraphics/updateImplicitFunctionSurface.m
index 9bbacf69..d7912c08 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateImplicitFunctionSurface.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateImplicitFunctionSurface.m
@@ -1,158 +1,130 @@
function obj = updateImplicitFunctionSurface(obj, surfaceIndex)
-
-%-AXIS INDEX-%
-axIndex = obj.getAxisIndex(obj.State.Plot(surfaceIndex).AssociatedAxis);
-
-%-CHECK FOR MULTIPLE AXES-%
-[xsource, ysource] = findSourceAxis(obj,axIndex);
-
-%-SURFACE DATA STRUCTURE- %
-image_data = obj.State.Plot(surfaceIndex).Handle;
-figure_data = obj.State.Figure.Handle;
-
-%-AXIS DATA-%
-xaxis = obj.layout.("xaxis" + xsource);
-yaxis = obj.layout.("yaxis" + ysource);
-
-%-------------------------------------------------------------------------%
-
-%-surface xaxis-%
-obj.data{surfaceIndex}.xaxis = ['x' num2str(xsource)];
-
-%-------------------------------------------------------------------------%
-
-%-surface yaxis-%
-obj.data{surfaceIndex}.yaxis = ['y' num2str(ysource)];
-
-%-------------------------------------------------------------------------%
-
-%-surface type-%
-obj.data{surfaceIndex}.type = 'surface';
-
-%---------------------------------------------------------------------%
-
-%-getting x,y,z surface data-%
-
-strf = func2str(image_data.Function);
-ind1 = strfind(strf, '('); ind1 = ind1(1)+1;
-ind2 = strfind(strf, ')'); ind2 = ind2(1)-1;
-vars = split(strf(ind1:ind2), ',');
-
-strf = [strf(ind2+2:end) '==0'];
-strf = replace(strf, vars{1}, 'Xx');
-strf = replace(strf, vars{2}, 'Yy');
-strf = replace(strf, vars{3}, 'Zz');
-
-syms Xx Yy Zz;
-f = eval(strf);
-s = solve(f, Zz);
-
-x = image_data.XRange;
-y = image_data.YRange;
-z = image_data.ZRange;
-N = 400;
-
-[Xx,Yy] = meshgrid(linspace(x(1),x(2),N), linspace(y(1),y(2),N));
-X = []; Y = []; Z = [];
-
-for n = 1:length(s)
- X = [X; Xx];
- Y = [Y; Yy];
- Z = [Z; eval(s(n))];
-end
-
-clear Xx Yy Zz;
-Z(Z < z(1)) = nan; Z(Z > z(2)) = nan;
-X(Z < z(1)) = nan; X(Z > z(2)) = nan;
-Y(Z < z(1)) = nan; Y(Z > z(2)) = nan;
-
-%---------------------------------------------------------------------%
-
-%-surface x-%
-obj.data{surfaceIndex}.x = X;
-
-%---------------------------------------------------------------------%
-
-%-surface y-%
-obj.data{surfaceIndex}.y = Y;
-
-%---------------------------------------------------------------------%
-
-%-surface z-%
-obj.data{surfaceIndex}.z = Z;
-
-%---------------------------------------------------------------------%
-
-%- setting grid mesh by default -%
-% x-direction
-mden = image_data.MeshDensity;
-xsize = (x(2) - x(1)) / mden;
-obj.data{surfaceIndex}.contours.x.start = x(1);
-obj.data{surfaceIndex}.contours.x.end = x(2);
-obj.data{surfaceIndex}.contours.x.size = xsize;
-obj.data{surfaceIndex}.contours.x.show = true;
-obj.data{surfaceIndex}.contours.x.color = 'black';
-% y-direction
-ysize = (y(2) - y(1)) / mden;
-obj.data{surfaceIndex}.contours.y.start = y(1);
-obj.data{surfaceIndex}.contours.y.end = y(2);
-obj.data{surfaceIndex}.contours.y.size = ysize;
-obj.data{surfaceIndex}.contours.y.show = true;
-obj.data{surfaceIndex}.contours.y.color = 'black';
-% z-direction
-zsize = (z(2) - z(1)) / mden;
-obj.data{surfaceIndex}.contours.z.start = z(1);
-obj.data{surfaceIndex}.contours.z.end = z(2);
-obj.data{surfaceIndex}.contours.z.size = zsize;
-obj.data{surfaceIndex}.contours.z.show = true;
-obj.data{surfaceIndex}.contours.z.color = 'black';
-
-%-------------------------------------------------------------------------%
-
-%-image colorscale-%
-
-cmap = figure_data.Colormap;
-len = length(cmap)-1;
-
-for c = 1: length(cmap)
- col = 255 * cmap(c, :);
- obj.data{surfaceIndex}.colorscale{c} = { (c-1)/len , ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')' ] };
-end
-
-%-------------------------------------------------------------------------%
-
-%-image surfacescale-%
-obj.data{surfaceIndex}.surfacecolor = Z;
-
-%-------------------------------------------------------------------------%
-
-%-surface name-%
-obj.data{surfaceIndex}.name = image_data.DisplayName;
-
-%-------------------------------------------------------------------------%
-
-%-surface showscale-%
-obj.data{surfaceIndex}.showscale = false;
-
-%-------------------------------------------------------------------------%
-
-%-surface visible-%
-obj.data{surfaceIndex}.visible = strcmp(image_data.Visible,'on');
-
-%-------------------------------------------------------------------------%
-
-leg = image_data.Annotation;
-legInfo = leg.LegendInformation;
-
-switch legInfo.IconDisplayStyle
- case 'on'
- showleg = true;
- case 'off'
- showleg = false;
-end
-
-obj.data{surfaceIndex}.showlegend = showleg;
-
-%-------------------------------------------------------------------------%
-
+ %-AXIS INDEX-%
+ axIndex = obj.getAxisIndex(obj.State.Plot(surfaceIndex).AssociatedAxis);
+
+ %-CHECK FOR MULTIPLE AXES-%
+ [xsource, ysource] = findSourceAxis(obj,axIndex);
+
+ %-SURFACE DATA STRUCTURE- %
+ image_data = obj.State.Plot(surfaceIndex).Handle;
+ figure_data = obj.State.Figure.Handle;
+
+ %-AXIS DATA-%
+ xaxis = obj.layout.("xaxis" + xsource);
+ yaxis = obj.layout.("yaxis" + ysource);
+
+ %---------------------------------------------------------------------%
+
+ %-surface xaxis and yaxis-%
+ obj.data{surfaceIndex}.xaxis = ['x' num2str(xsource)];
+ obj.data{surfaceIndex}.yaxis = ['y' num2str(ysource)];
+
+ %---------------------------------------------------------------------%
+
+ %-surface type-%
+ obj.data{surfaceIndex}.type = 'surface';
+
+ %---------------------------------------------------------------------%
+
+ %-getting x,y,z surface data-%
+
+ strf = func2str(image_data.Function);
+ ind1 = strfind(strf, '('); ind1 = ind1(1)+1;
+ ind2 = strfind(strf, ')'); ind2 = ind2(1)-1;
+ vars = split(strf(ind1:ind2), ',');
+
+ strf = [strf(ind2+2:end) '==0'];
+ strf = replace(strf, vars{1}, 'Xx');
+ strf = replace(strf, vars{2}, 'Yy');
+ strf = replace(strf, vars{3}, 'Zz');
+
+ syms Xx Yy Zz;
+ f = eval(strf);
+ s = solve(f, Zz);
+
+ x = image_data.XRange;
+ y = image_data.YRange;
+ z = image_data.ZRange;
+ N = 400;
+
+ [Xx,Yy] = meshgrid(linspace(x(1),x(2),N), linspace(y(1),y(2),N));
+ X = []; Y = []; Z = [];
+
+ for n = 1:length(s)
+ X = [X; Xx];
+ Y = [Y; Yy];
+ Z = [Z; eval(s(n))];
+ end
+
+ clear Xx Yy Zz;
+ Z(Z < z(1)) = nan; Z(Z > z(2)) = nan;
+ X(Z < z(1)) = nan; X(Z > z(2)) = nan;
+ Y(Z < z(1)) = nan; Y(Z > z(2)) = nan;
+
+ %---------------------------------------------------------------------%
+
+ %-surface x,z,y-%
+ obj.data{surfaceIndex}.x = X;
+ obj.data{surfaceIndex}.y = Y;
+ obj.data{surfaceIndex}.z = Z;
+
+ %---------------------------------------------------------------------%
+
+ %- setting grid mesh by default -%
+ % x-direction
+ mden = image_data.MeshDensity;
+ xsize = (x(2) - x(1)) / mden;
+ obj.data{surfaceIndex}.contours.x.start = x(1);
+ obj.data{surfaceIndex}.contours.x.end = x(2);
+ obj.data{surfaceIndex}.contours.x.size = xsize;
+ obj.data{surfaceIndex}.contours.x.show = true;
+ obj.data{surfaceIndex}.contours.x.color = 'black';
+ % y-direction
+ ysize = (y(2) - y(1)) / mden;
+ obj.data{surfaceIndex}.contours.y.start = y(1);
+ obj.data{surfaceIndex}.contours.y.end = y(2);
+ obj.data{surfaceIndex}.contours.y.size = ysize;
+ obj.data{surfaceIndex}.contours.y.show = true;
+ obj.data{surfaceIndex}.contours.y.color = 'black';
+ % z-direction
+ zsize = (z(2) - z(1)) / mden;
+ obj.data{surfaceIndex}.contours.z.start = z(1);
+ obj.data{surfaceIndex}.contours.z.end = z(2);
+ obj.data{surfaceIndex}.contours.z.size = zsize;
+ obj.data{surfaceIndex}.contours.z.show = true;
+ obj.data{surfaceIndex}.contours.z.color = 'black';
+
+ %---------------------------------------------------------------------%
+
+ %-image colorscale-%
+
+ cmap = figure_data.Colormap;
+ len = length(cmap)-1;
+
+ for c = 1: length(cmap)
+ col = 255 * cmap(c, :);
+ obj.data{surfaceIndex}.colorscale{c} = ...
+ { (c-1)/len , sprintf("rgb(%f,%f,%f)", col)};
+ end
+
+ %---------------------------------------------------------------------%
+
+ obj.data{surfaceIndex}.surfacecolor = Z;
+ obj.data{surfaceIndex}.name = image_data.DisplayName;
+ obj.data{surfaceIndex}.showscale = false;
+ obj.data{surfaceIndex}.visible = strcmp(image_data.Visible, 'on');
+
+ %---------------------------------------------------------------------%
+
+ leg = image_data.Annotation;
+ legInfo = leg.LegendInformation;
+
+ switch legInfo.IconDisplayStyle
+ case 'on'
+ showleg = true;
+ case 'off'
+ showleg = false;
+ end
+
+ obj.data{surfaceIndex}.showlegend = showleg;
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateIsosurface.m b/plotly/plotlyfig_aux/handlegraphics/updateIsosurface.m
index ed17adb0..4e317ad6 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateIsosurface.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateIsosurface.m
@@ -1,7 +1,4 @@
function obj = updateIsosurface(obj, isoIndex)
-
- %-------------------------------------------------------------------------%
-
%-INITIALIZATIONS-%
axIndex = obj.getAxisIndex(obj.State.Plot(isoIndex).AssociatedAxis);
@@ -21,14 +18,14 @@
jData = plotData.Faces(:, 2) - 1;
kData = plotData.Faces(:, 3) - 1;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-get trace-%
obj.data{isoIndex}.type = 'mesh3d';
obj.data{isoIndex}.name = plotData.DisplayName;
obj.data{isoIndex}.showscale = false;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set mesh data-%
obj.data{isoIndex}.x = xData;
@@ -39,7 +36,7 @@
obj.data{isoIndex}.j = jData;
obj.data{isoIndex}.k = kData;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-mesh coloring-%
faceColor = getFaceColor(plotData, axisData);
@@ -50,7 +47,7 @@
obj.data{isoIndex}.color = faceColor;
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-lighting settings-%
if ~strcmp(plotData.FaceLighting, 'flat')
@@ -63,16 +60,13 @@
obj.data{isoIndex}.lighting.facenormalsepsilon = 1e-6;
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-associate scene to trace-%
obj.data{isoIndex}.scene = sprintf('scene%d', xSource);
-
- %-------------------------------------------------------------------------%
end
function updateScene(obj, isoIndex)
-
%-INITIALIZATIONS-%
axIndex = obj.getAxisIndex(obj.State.Plot(isoIndex).AssociatedAxis);
plotData = obj.State.Plot(isoIndex).Handle;
@@ -154,7 +148,6 @@ function updateScene(obj, isoIndex)
end
function fillColor = getFaceColor(plotData, axisData)
-
%-initializations-%
faceColor = plotData.FaceColor;
cData = plotData.CData;
@@ -165,10 +158,8 @@ function updateScene(obj, isoIndex)
if isnumeric(faceColor)
numColor = 255 * faceColor;
fillColor = sprintf('rgb(%f,%f,%f)', numColor);
-
elseif strcmpi(faceColor, 'flat')
fillColor = getStringColor(cData, colorMap, cLim);
-
elseif strcmpi(faceColor, 'interp')
if size(cData, 1) ~= 1
for n = 1:size(cData, 2)
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateLineseries.m b/plotly/plotlyfig_aux/handlegraphics/updateLineseries.m
index fb5145a9..26006e8f 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateLineseries.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateLineseries.m
@@ -1,7 +1,4 @@
function updateLineseries(obj, plotIndex)
-
- %-------------------------------------------------------------------------%
-
%-INITIALIZATIONS-%
axIndex = obj.getAxisIndex(obj.State.Plot(plotIndex).AssociatedAxis);
@@ -47,7 +44,7 @@ function updateLineseries(obj, plotIndex)
zData = plotData.ZData;
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set trace-%
if isPolar
@@ -70,7 +67,7 @@ function updateLineseries(obj, plotIndex)
obj.data{plotIndex}.name = plotData.DisplayName;
obj.data{plotIndex}.mode = getScatterMode(plotData);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set trace data-%
if isPolar
@@ -87,7 +84,7 @@ function updateLineseries(obj, plotIndex)
end
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set trace line-%
obj.data{plotIndex}.line = extractLineLine(plotData);
@@ -100,14 +97,9 @@ function updateLineseries(obj, plotIndex)
%-set trace legend-%
obj.data{plotIndex}.showlegend = getShowLegend(plotData);
-
- %-------------------------------------------------------------------------%
end
function updateScene(obj, dataIndex)
-
- %-------------------------------------------------------------------------%
-
%-INITIALIZATIONS-%
axIndex = obj.getAxisIndex(obj.State.Plot(dataIndex).AssociatedAxis);
plotData = obj.State.Plot(dataIndex).Handle;
@@ -127,7 +119,7 @@ function updateScene(obj, dataIndex)
normFac = abs(min(cameraEye));
normFac = normFac / (max(aspectRatio)/min(aspectRatio) + cameraOffset);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-aspect ratio-%
scene.aspectratio.x = 1.0*aspectRatio(1);
@@ -144,7 +136,7 @@ function updateScene(obj, dataIndex)
scene.camera.up.y = cameraUpVector(2);
scene.camera.up.z = cameraUpVector(3);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-scene axis configuration-%
scene.xaxis.range = axisData.XLim;
@@ -182,7 +174,6 @@ function updateScene(obj, dataIndex)
if isduration(xTick) || isdatetime(xTick)
xTickChar = char(xTick);
xTickLabel = axisData.XTickLabel;
-
for n = 1:length(xTickLabel)
for m = 1:size(xTickChar, 1)
if ~isempty(strfind(string(xTickChar(m, :)), xTickLabel{n}))
@@ -190,7 +181,6 @@ function updateScene(obj, dataIndex)
end
end
end
-
xTick = datenum(xTick(idx));
end
@@ -198,7 +188,6 @@ function updateScene(obj, dataIndex)
if isduration(yTick) || isdatetime(yTick)
yTickChar = char(yTick);
yTickLabel = axisData.YTickLabel;
-
for n = 1:length(yTickLabel)
for m = 1:size(yTickChar, 1)
if ~isempty(strfind(string(yTickChar(m, :)), yTickLabel{n}))
@@ -206,7 +195,6 @@ function updateScene(obj, dataIndex)
end
end
end
-
yTick = datenum(yTick(idx));
end
@@ -215,7 +203,6 @@ function updateScene(obj, dataIndex)
if isduration(zTick) || isdatetime(zTick)
zTickChar = char(zTick);
zTickLabel = axisData.ZTickLabel;
-
for n = 1:length(zTickLabel)
for m = 1:size(zTickChar, 1)
if ~isempty(strfind(string(zTickChar(m, :)), zTickLabel{n}))
@@ -223,7 +210,6 @@ function updateScene(obj, dataIndex)
end
end
end
-
zTick = datenum(zTick(idx));
end
@@ -249,18 +235,13 @@ function updateScene(obj, dataIndex)
if strcmp(axisData.YGrid, 'off'), scene.yaxis.showgrid = false; end
if strcmp(axisData.ZGrid, 'off'), scene.zaxis.showgrid = false; end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-SET SCENE TO LAYOUT-%
obj.layout = setfield(obj.layout, sprintf('scene%d', xSource), scene);
-
- %-------------------------------------------------------------------------%
end
function updateDefaultPolaraxes(obj, plotIndex)
-
- %-------------------------------------------------------------------------%
-
%-INITIALIZATIONS-%
axIndex = obj.getAxisIndex(obj.State.Plot(plotIndex).AssociatedAxis);
[xSource, ysource] = findSourceAxis(obj, axIndex);
@@ -270,7 +251,7 @@ function updateDefaultPolaraxes(obj, plotIndex)
thetaAxis = axisData.XAxis;
rAxis = axisData.YAxis;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set domain plot-%
xo = axisData.Position(1);
@@ -284,7 +265,7 @@ function updateDefaultPolaraxes(obj, plotIndex)
tickValues = rAxis.TickValues;
tickValues = tickValues(find(tickValues==0) + 1 : end);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-SET ANGULAR AXIS-%
@@ -303,9 +284,9 @@ function updateDefaultPolaraxes(obj, plotIndex)
polarAxis.angularaxis.nticks = 16;
polarAxis.angularaxis.tickfont.size = thetaAxis.FontSize;
polarAxis.angularaxis.tickfont.color = getStringColor(...
- 255*thetaAxis.Color);
+ 255*thetaAxis.Color);
polarAxis.angularaxis.tickfont.family = matlab2plotlyfont(...
- thetaAxis.FontName);
+ thetaAxis.FontName);
%-axis label-%
thetaLabel = thetaAxis.Label;
@@ -313,11 +294,11 @@ function updateDefaultPolaraxes(obj, plotIndex)
polarAxis.angularaxis.title.text = thetaLabel.String;
polarAxis.radialaxis.title.font.size = thetaLabel.FontSize;
polarAxis.radialaxis.title.font.color = getStringColor(...
- 255*thetaLabel.Color);
+ 255*thetaLabel.Color);
polarAxis.radialaxis.title.font.family = matlab2plotlyfont(...
- thetaLabel.FontName);
+ thetaLabel.FontName);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-SET RADIAL AXIS-%
@@ -337,7 +318,7 @@ function updateDefaultPolaraxes(obj, plotIndex)
polarAxis.radialaxis.tickfont.size = rAxis.FontSize;
polarAxis.radialaxis.tickfont.color = getStringColor(255*rAxis.Color);
polarAxis.radialaxis.tickfont.family = matlab2plotlyfont(...
- rAxis.FontName);
+ rAxis.FontName);
%-axis label-%
rLabel = rAxis.Label;
@@ -346,13 +327,11 @@ function updateDefaultPolaraxes(obj, plotIndex)
polarAxis.radialaxis.title.font.size = rLabel.FontSize;
polarAxis.radialaxis.title.font.color = getStringColor(255*rLabel.Color);
polarAxis.radialaxis.title.font.family = matlab2plotlyfont(...
- rLabel.FontName);
+ rLabel.FontName);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set Polar Axes to layout-%
obj.layout = setfield(obj.layout, sprintf('polar%d', xSource+1), ...
- polarAxis);
-
- %-------------------------------------------------------------------------%
+ polarAxis);
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateMesh.m b/plotly/plotlyfig_aux/handlegraphics/updateMesh.m
index 75d8ae36..1e258253 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateMesh.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateMesh.m
@@ -1,417 +1,408 @@
function obj = updateMesh(obj, surfaceIndex)
+ %-AXIS INDEX-%
+ axIndex = obj.getAxisIndex(obj.State.Plot(surfaceIndex).AssociatedAxis);
-%-AXIS INDEX-%
-axIndex = obj.getAxisIndex(obj.State.Plot(surfaceIndex).AssociatedAxis);
+ %-CHECK FOR MULTIPLE AXES-%
+ [xsource, ysource] = findSourceAxis(obj,axIndex);
-%-CHECK FOR MULTIPLE AXES-%
-[xsource, ysource] = findSourceAxis(obj,axIndex);
+ %-SURFACE DATA STRUCTURE- %
+ meshData = obj.State.Plot(surfaceIndex).Handle;
-%-SURFACE DATA STRUCTURE- %
-meshData = obj.State.Plot(surfaceIndex).Handle;
+ %-AXIS STRUCTURE-%
+ axisData = ancestor(meshData.Parent,'axes');
-%-AXIS STRUCTURE-%
-axisData = ancestor(meshData.Parent,'axes');
+ %-SCENE DATA-%
+ scene = obj.layout.("scene" + xsource);
-%-SCENE DATA-%
-scene = obj.layout.("scene" + xsource);
+ %-GET CONTOUR INDEX-%
+ obj.PlotOptions.nPlots = obj.PlotOptions.nPlots + 1;
+ contourIndex = obj.PlotOptions.nPlots;
+ obj.PlotOptions.contourIndex(surfaceIndex) = contourIndex;
-%-GET CONTOUR INDEX-%
-obj.PlotOptions.nPlots = obj.PlotOptions.nPlots + 1;
-contourIndex = obj.PlotOptions.nPlots;
-obj.PlotOptions.contourIndex(surfaceIndex) = contourIndex;
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-associate scene-%
+ obj.data{surfaceIndex}.scene = sprintf('scene%d', xsource);
+ obj.data{contourIndex}.scene = sprintf('scene%d', xsource);
-%-associate scene-%
-obj.data{surfaceIndex}.scene = sprintf('scene%d', xsource);
-obj.data{contourIndex}.scene = sprintf('scene%d', xsource);
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-surface type for face color-%
+ obj.data{surfaceIndex}.type = 'surface';
+
+ %-scatter3d type for contour mesh lines-%
+ obj.data{contourIndex}.type = 'scatter3d';
+ obj.data{contourIndex}.mode = 'lines';
-%-surface type for face color-%
-obj.data{surfaceIndex}.type = 'surface';
-
-%-scatter3d type for contour mesh lines-%
-obj.data{contourIndex}.type = 'scatter3d';
-obj.data{contourIndex}.mode = 'lines';
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-get plot data-%
+ xData = meshData.XData;
+ yData = meshData.YData;
+ zData = meshData.ZData;
-%-get plot data-%
-xData = meshData.XData;
-yData = meshData.YData;
-zData = meshData.ZData;
+ if isvector(xData)
+ [xData, yData] = meshgrid(xData, yData);
+ end
-if isvector(xData)
- [xData, yData] = meshgrid(xData, yData);
-end
+ %-reformat data to mesh-%
+ xDataSurface = xData;
+ yDataSurface = yData;
+ zDataSurface = zData;
-%-reformat data to mesh-%
-xDataSurface = xData;
-yDataSurface = yData;
-zDataSurface = zData;
+ xDataContourDir1 = [xDataSurface; NaN(1, size(xDataSurface, 2))];
+ yDataContourDir1 = [yDataSurface; NaN(1, size(yDataSurface, 2))];
+ zDataContourDir1 = [zDataSurface; NaN(1, size(zDataSurface, 2))];
-xDataContourDir1 = [xDataSurface; NaN(1, size(xDataSurface, 2))];
-yDataContourDir1 = [yDataSurface; NaN(1, size(yDataSurface, 2))];
-zDataContourDir1 = [zDataSurface; NaN(1, size(zDataSurface, 2))];
+ xDataContourDir2 = xDataContourDir1(1:end-1,:)';
+ yDataContourDir2 = yDataContourDir1(1:end-1,:)';
+ zDataContourDir2 = zDataContourDir1(1:end-1,:)';
-xDataContourDir2 = xDataContourDir1(1:end-1,:)';
-yDataContourDir2 = yDataContourDir1(1:end-1,:)';
-zDataContourDir2 = zDataContourDir1(1:end-1,:)';
+ xDataContourDir2 = [xDataContourDir2; NaN(1, size(xDataContourDir2, 2))];
+ yDataContourDir2 = [yDataContourDir2; NaN(1, size(yDataContourDir2, 2))];
+ zDataContourDir2 = [zDataContourDir2; NaN(1, size(zDataContourDir2, 2))];
-xDataContourDir2 = [xDataContourDir2; NaN(1, size(xDataContourDir2, 2))];
-yDataContourDir2 = [yDataContourDir2; NaN(1, size(yDataContourDir2, 2))];
-zDataContourDir2 = [zDataContourDir2; NaN(1, size(zDataContourDir2, 2))];
+ xDataContour = [xDataContourDir1(:); xDataContourDir2(:)];
+ yDataContour = [yDataContourDir1(:); yDataContourDir2(:)];
+ zDataContour = [zDataContourDir1(:); zDataContourDir2(:)];
-xDataContour = [xDataContourDir1(:); xDataContourDir2(:)];
-yDataContour = [yDataContourDir1(:); yDataContourDir2(:)];
-zDataContour = [zDataContourDir1(:); zDataContourDir2(:)];
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-set data on surface-%
+ obj.data{surfaceIndex}.x = xDataSurface;
+ obj.data{surfaceIndex}.y = yDataSurface;
+ obj.data{surfaceIndex}.z = zDataSurface;
-%-set data on surface-%
-obj.data{surfaceIndex}.x = xDataSurface;
-obj.data{surfaceIndex}.y = yDataSurface;
-obj.data{surfaceIndex}.z = zDataSurface;
+ %- setting grid mesh by default -%
+ % x-direction
+ xData = xData(1, :);
+ obj.data{surfaceIndex}.contours.x.start = xData(1);
+ obj.data{surfaceIndex}.contours.x.end = xData(end);
+ obj.data{surfaceIndex}.contours.x.size = mean(diff(xData));
+ obj.data{surfaceIndex}.contours.x.show = true;
-%- setting grid mesh by default -%
-% x-direction
-xData = xData(1, :);
-obj.data{surfaceIndex}.contours.x.start = xData(1);
-obj.data{surfaceIndex}.contours.x.end = xData(end);
-obj.data{surfaceIndex}.contours.x.size = mean(diff(xData));
-obj.data{surfaceIndex}.contours.x.show = true;
+ % y-direction
+ yData = yData(:, 1);
+ obj.data{surfaceIndex}.contours.y.start = yData(1);
+ obj.data{surfaceIndex}.contours.y.end = yData(end);
+ obj.data{surfaceIndex}.contours.y.size = mean(diff(yData));;
+ obj.data{surfaceIndex}.contours.y.show = true;
-% y-direction
-yData = yData(:, 1);
-obj.data{surfaceIndex}.contours.y.start = yData(1);
-obj.data{surfaceIndex}.contours.y.end = yData(end);
-obj.data{surfaceIndex}.contours.y.size = mean(diff(yData));;
-obj.data{surfaceIndex}.contours.y.show = true;
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-set data on scatter3d-%
+ obj.data{contourIndex}.x = xDataContour(:);
+ obj.data{contourIndex}.y = yDataContour(:);
+ obj.data{contourIndex}.z = zDataContour(:);
-%-set data on scatter3d-%
-obj.data{contourIndex}.x = xDataContour(:);
-obj.data{contourIndex}.y = yDataContour(:);
-obj.data{contourIndex}.z = zDataContour(:);
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-COLORING-%
-%-COLORING-%
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-get colormap-%
+ cMap = axisData.Colormap;
+ fac = 1/(length(cMap)-1);
+ colorScale = {};
-%-get colormap-%
-cMap = axisData.Colormap;
-fac = 1/(length(cMap)-1);
-colorScale = {};
+ for c = 1: length(cMap)
+ colorScale{c} = { (c-1)*fac , sprintf('rgb(%f,%f,%f)', 255*cMap(c, :))};
+ end
-for c = 1: length(cMap)
- colorScale{c} = { (c-1)*fac , sprintf('rgb(%f,%f,%f)', 255*cMap(c, :))};
-end
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-get edge color-%
+ if isnumeric(meshData.EdgeColor)
+ cDataContour = sprintf('rgb(%f,%f,%f)', 255*meshData.EdgeColor);
-%-get edge color-%
-if isnumeric(meshData.EdgeColor)
- cDataContour = sprintf('rgb(%f,%f,%f)', 255*meshData.EdgeColor);
+ elseif strcmpi(meshData.EdgeColor, 'interp')
+ cDataContour = zDataContour(:);
+ obj.data{contourIndex}.line.colorscale = colorScale;
-elseif strcmpi(meshData.EdgeColor, 'interp')
- cDataContour = zDataContour(:);
- obj.data{contourIndex}.line.colorscale = colorScale;
+ obj.data{surfaceIndex}.contours.x.show = false;
+ obj.data{surfaceIndex}.contours.y.show = false;
- obj.data{surfaceIndex}.contours.x.show = false;
- obj.data{surfaceIndex}.contours.y.show = false;
+ elseif strcmpi(meshData.EdgeColor, 'flat')
+ cData = meshData.CData;
-elseif strcmpi(meshData.EdgeColor, 'flat')
- cData = meshData.CData;
+ if size(cData, 3) ~= 1
+ cMap = unique( reshape(cData, ...
+ [size(cData,1)*size(cData,2), size(cData,3)]), 'rows' );
+ cData = rgb2ind(cData, cMap);
- if size(cData, 3) ~= 1
- cMap = unique( reshape(cData, ...
- [size(cData,1)*size(cData,2), size(cData,3)]), 'rows' );
- cData = rgb2ind(cData, cMap);
+ edgeColorScale = {};
+ fac = 1/(length(cMap)-1);
- edgeColorScale = {};
- fac = 1/(length(cMap)-1);
+ for c = 1: length(cMap)
+ edgeColorScale{c} = { (c-1)*fac , sprintf('rgb(%f,%f,%f)', 255*cMap(c, :))};
+ end
- for c = 1: length(cMap)
- edgeColorScale{c} = { (c-1)*fac , sprintf('rgb(%f,%f,%f)', 255*cMap(c, :))};
+ obj.data{surfaceIndex}.line.cmin = 0;
+ obj.data{surfaceIndex}.line.cmax = 255;
+ obj.data{contourIndex}.line.colorscale = edgeColorScale;
+ else
+ obj.data{contourIndex}.line.cmin = axisData.CLim(1);
+ obj.data{contourIndex}.line.cmax = axisData.CLim(2);
+ obj.data{contourIndex}.line.colorscale = colorScale;
end
- obj.data{surfaceIndex}.line.cmin = 0;
- obj.data{surfaceIndex}.line.cmax = 255;
- obj.data{contourIndex}.line.colorscale = edgeColorScale;
- else
- obj.data{contourIndex}.line.cmin = axisData.CLim(1);
- obj.data{contourIndex}.line.cmax = axisData.CLim(2);
- obj.data{contourIndex}.line.colorscale = colorScale;
- end
-
- cDataContourDir1 = [cData; NaN(1, size(cData, 2))];
- cDataContourDir2 = cDataContourDir1(1:end-1,:)';
- cDataContourDir2 = [cDataContourDir2; NaN(1, size(cDataContourDir2, 2))];
- cDataContour = [cDataContourDir1(:); cDataContourDir2(:)];
+ cDataContourDir1 = [cData; NaN(1, size(cData, 2))];
+ cDataContourDir2 = cDataContourDir1(1:end-1,:)';
+ cDataContourDir2 = [cDataContourDir2; NaN(1, size(cDataContourDir2, 2))];
+ cDataContour = [cDataContourDir1(:); cDataContourDir2(:)];
- obj.data{surfaceIndex}.contours.x.show = false;
- obj.data{surfaceIndex}.contours.y.show = false;
+ obj.data{surfaceIndex}.contours.x.show = false;
+ obj.data{surfaceIndex}.contours.y.show = false;
-elseif strcmpi(meshData.EdgeColor, 'none')
- cDataContour = 'rgba(0,0,0,0)';
- obj.data{surfaceIndex}.contours.x.show = false;
- obj.data{surfaceIndex}.contours.y.show = false;
+ elseif strcmpi(meshData.EdgeColor, 'none')
+ cDataContour = 'rgba(0,0,0,0)';
+ obj.data{surfaceIndex}.contours.x.show = false;
+ obj.data{surfaceIndex}.contours.y.show = false;
-end
+ end
-%-set edge color-%
-obj.data{contourIndex}.line.color = cDataContour;
-obj.data{surfaceIndex}.contours.x.color = cDataContour;
-obj.data{surfaceIndex}.contours.y.color = cDataContour;
+ %-set edge color-%
+ obj.data{contourIndex}.line.color = cDataContour;
+ obj.data{surfaceIndex}.contours.x.color = cDataContour;
+ obj.data{surfaceIndex}.contours.y.color = cDataContour;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-get face color-%
-faceColor = meshData.FaceColor;
+ %-get face color-%
+ faceColor = meshData.FaceColor;
-if isnumeric(faceColor)
+ if isnumeric(faceColor)
- if all(faceColor == [1, 1, 1])
- faceColor = [0.96, 0.96, 0.96];
- end
+ if all(faceColor == [1, 1, 1])
+ faceColor = [0.96, 0.96, 0.96];
+ end
- for n = 1:size(zDataSurface, 2)
- for m = 1:size(zDataSurface, 1)
- cDataSurface(m, n, :) = faceColor;
+ for n = 1:size(zDataSurface, 2)
+ for m = 1:size(zDataSurface, 1)
+ cDataSurface(m, n, :) = faceColor;
+ end
end
- end
- [cDataSurface, cMapSurface] = rgb2ind(cDataSurface, 256);
- cDataSurface = double(cDataSurface) + axisData.CLim(1);
+ [cDataSurface, cMapSurface] = rgb2ind(cDataSurface, 256);
+ cDataSurface = double(cDataSurface) + axisData.CLim(1);
- for c = 1: size(cMapSurface, 1)
- colorScale{c} = { (c-1)*fac , sprintf('rgba(%f,%f,%f, 1)', cMapSurface(c, :))};
- end
+ for c = 1: size(cMapSurface, 1)
+ colorScale{c} = { (c-1)*fac , sprintf('rgba(%f,%f,%f, 1)', cMapSurface(c, :))};
+ end
- obj.data{surfaceIndex}.cmin = axisData.CLim(1);
- obj.data{surfaceIndex}.cmax = axisData.CLim(2);
+ obj.data{surfaceIndex}.cmin = axisData.CLim(1);
+ obj.data{surfaceIndex}.cmax = axisData.CLim(2);
-elseif strcmpi(faceColor, 'interp')
- cDataSurface = zDataSurface;
+ elseif strcmpi(faceColor, 'interp')
+ cDataSurface = zDataSurface;
- if surfaceIndex > xsource
- cData = [];
+ if surfaceIndex > xsource
+ cData = [];
- for idx = xsource:surfaceIndex
- cData = [cData; obj.data{idx}.z];
- end
+ for idx = xsource:surfaceIndex
+ cData = [cData; obj.data{idx}.z];
+ end
- cMin = min(cData(:));
- cMax = max(cData(:));
+ cMin = min(cData(:));
+ cMax = max(cData(:));
- for idx = xsource:surfaceIndex
- obj.data{idx}.cmin = cMin;
- obj.data{idx}.cmax = cMax;
+ for idx = xsource:surfaceIndex
+ obj.data{idx}.cmin = cMin;
+ obj.data{idx}.cmax = cMax;
+ end
end
- end
-elseif strcmpi(faceColor, 'flat')
- cData = meshData.CData;
+ elseif strcmpi(faceColor, 'flat')
+ cData = meshData.CData;
- if size(cData, 3) ~= 1
- cMap = unique( reshape(cData, ...
- [size(cData,1)*size(cData,2), size(cData,3)]), 'rows' );
- cDataSurface = rgb2ind(cData, cMap);
+ if size(cData, 3) ~= 1
+ cMap = unique( reshape(cData, ...
+ [size(cData,1)*size(cData,2), size(cData,3)]), 'rows' );
+ cDataSurface = rgb2ind(cData, cMap);
- colorScale = {};
- fac = 1/(length(cMap)-1);
+ colorScale = {};
+ fac = 1/(length(cMap)-1);
- for c = 1: length(cMap)
- colorScale{c} = { (c-1)*fac , sprintf('rgb(%f,%f,%f)', 255*cMap(c, :))};
+ for c = 1: length(cMap)
+ colorScale{c} = { (c-1)*fac , sprintf('rgb(%f,%f,%f)', 255*cMap(c, :))};
+ end
+ else
+ cDataSurface = cData;
+ obj.data{surfaceIndex}.cmin = axisData.CLim(1);
+ obj.data{surfaceIndex}.cmax = axisData.CLim(2);
end
- else
- cDataSurface = cData;
- obj.data{surfaceIndex}.cmin = axisData.CLim(1);
- obj.data{surfaceIndex}.cmax = axisData.CLim(2);
+
end
-
-end
-%-set face color-%
-obj.data{surfaceIndex}.colorscale = colorScale;
-obj.data{surfaceIndex}.surfacecolor = cDataSurface;
+ %-set face color-%
+ obj.data{surfaceIndex}.colorscale = colorScale;
+ obj.data{surfaceIndex}.surfacecolor = cDataSurface;
-%-lighting settings-%
+ %-lighting settings-%
-if isnumeric(meshData.FaceColor) && all(meshData.FaceColor == [1, 1, 1])
- obj.data{surfaceIndex}.lighting.diffuse = 0.5;
- obj.data{surfaceIndex}.lighting.ambient = 0.725;
-else
- % obj.data{surfaceIndex}.lighting.diffuse = 1.0;
- % obj.data{surfaceIndex}.lighting.ambient = 0.9;
-end
+ if isnumeric(meshData.FaceColor) && all(meshData.FaceColor == [1, 1, 1])
+ obj.data{surfaceIndex}.lighting.diffuse = 0.5;
+ obj.data{surfaceIndex}.lighting.ambient = 0.725;
+ end
-if meshData.FaceAlpha ~= 1
- obj.data{surfaceIndex}.lighting.diffuse = 0.5;
- obj.data{surfaceIndex}.lighting.ambient = 0.725 + (1-meshData.FaceAlpha);
-end
+ if meshData.FaceAlpha ~= 1
+ obj.data{surfaceIndex}.lighting.diffuse = 0.5;
+ obj.data{surfaceIndex}.lighting.ambient = 0.725 + (1-meshData.FaceAlpha);
+ end
-if obj.PlotlyDefaults.IsLight
- obj.data{surfaceIndex}.lighting.diffuse = 1.0;
- obj.data{surfaceIndex}.lighting.ambient = 0.3;
-end
+ if obj.PlotlyDefaults.IsLight
+ obj.data{surfaceIndex}.lighting.diffuse = 1.0;
+ obj.data{surfaceIndex}.lighting.ambient = 0.3;
+ end
-%-opacity-%
-obj.data{surfaceIndex}.opacity = meshData.FaceAlpha;
+ %-opacity-%
+ obj.data{surfaceIndex}.opacity = meshData.FaceAlpha;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-line style-%
+ %-line style-%
-obj.data{contourIndex}.line.width = 3*meshData.LineWidth;
+ obj.data{contourIndex}.line.width = 3*meshData.LineWidth;
-if strcmpi(meshData.LineStyle, '-')
- obj.data{contourIndex}.line.dash = 'solid';
-else
- obj.data{contourIndex}.line.dash = 'dot';
- obj.data{surfaceIndex}.contours.x.show = false;
- obj.data{surfaceIndex}.contours.y.show = false;
-end
+ if strcmpi(meshData.LineStyle, '-')
+ obj.data{contourIndex}.line.dash = 'solid';
+ else
+ obj.data{contourIndex}.line.dash = 'dot';
+ obj.data{surfaceIndex}.contours.x.show = false;
+ obj.data{surfaceIndex}.contours.y.show = false;
+ end
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-SCENE CONFIGUTATION-%
+ %-SCENE CONFIGUTATION-%
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-aspect ratio-%
-asr = obj.PlotOptions.AspectRatio;
+ %-aspect ratio-%
+ asr = obj.PlotOptions.AspectRatio;
-if ~isempty(asr)
- if ischar(asr)
- scene.aspectmode = asr;
- elseif isvector(ar) && length(asr) == 3
- xar = asr(1);
- yar = asr(2);
- zar = asr(3);
+ if ~isempty(asr)
+ if ischar(asr)
+ scene.aspectmode = asr;
+ elseif isvector(ar) && length(asr) == 3
+ xar = asr(1);
+ yar = asr(2);
+ zar = asr(3);
+ end
+ else
+ %-define as default-%
+ xar = max(xData(:));
+ yar = max(yData(:));
+ xyar = max([xar, yar]);
+ zar = 0.75*xyar;
end
-else
-
- %-define as default-%
- xar = max(xData(:));
- yar = max(yData(:));
- xyar = max([xar, yar]);
- zar = 0.75*xyar;
-end
-scene.aspectratio.x = 1.1*xyar;
-scene.aspectratio.y = 1.0*xyar;
-scene.aspectratio.z = zar;
+ scene.aspectratio.x = 1.1*xyar;
+ scene.aspectratio.y = 1.0*xyar;
+ scene.aspectratio.z = zar;
-%---------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-camera eye-%
-ey = obj.PlotOptions.CameraEye;
+ %-camera eye-%
+ ey = obj.PlotOptions.CameraEye;
-if ~isempty(ey)
- if isvector(ey) && length(ey) == 3
- scene.camera.eye.x = ey(1);
- scene.camera.eye.y = ey(2);
- scene.camera.eye.z = ey(3);
+ if ~isempty(ey)
+ if isvector(ey) && length(ey) == 3
+ scene.camera.eye.x = ey(1);
+ scene.camera.eye.y = ey(2);
+ scene.camera.eye.z = ey(3);
+ end
+ else
+ %-define as default-%
+ xey = - xyar; if xey>0 xfac = -0.0; else xfac = 0.0; end
+ yey = - xyar; if yey>0 yfac = -0.3; else yfac = 0.3; end
+ if zar>0 zfac = -0.1; else zfac = 0.1; end
+
+ scene.camera.eye.x = xey + xfac*xey;
+ scene.camera.eye.y = yey + yfac*yey;
+ scene.camera.eye.z = zar + zfac*zar;
end
-else
-
- %-define as default-%
- xey = - xyar; if xey>0 xfac = -0.0; else xfac = 0.0; end
- yey = - xyar; if yey>0 yfac = -0.3; else yfac = 0.3; end
- if zar>0 zfac = -0.1; else zfac = 0.1; end
-
- scene.camera.eye.x = xey + xfac*xey;
- scene.camera.eye.y = yey + yfac*yey;
- scene.camera.eye.z = zar + zfac*zar;
-end
-
-%-------------------------------------------------------------------------%
-%-scene axis configuration-%
+ %---------------------------------------------------------------------%
-scene.xaxis.range = axisData.XLim;
-scene.yaxis.range = axisData.YLim;
-scene.zaxis.range = axisData.ZLim;
+ %-scene axis configuration-%
-scene.xaxis.tickvals = axisData.XTick;
-scene.xaxis.ticktext = axisData.XTickLabel;
+ scene.xaxis.range = axisData.XLim;
+ scene.yaxis.range = axisData.YLim;
+ scene.zaxis.range = axisData.ZLim;
-scene.yaxis.tickvals = axisData.YTick;
-scene.yaxis.ticktext = axisData.YTickLabel;
+ scene.xaxis.tickvals = axisData.XTick;
+ scene.xaxis.ticktext = axisData.XTickLabel;
-scene.zaxis.tickvals = axisData.ZTick;
-scene.zaxis.ticktext = axisData.ZTickLabel;
+ scene.yaxis.tickvals = axisData.YTick;
+ scene.yaxis.ticktext = axisData.YTickLabel;
-scene.xaxis.zeroline = false;
-scene.yaxis.zeroline = false;
-scene.zaxis.zeroline = false;
+ scene.zaxis.tickvals = axisData.ZTick;
+ scene.zaxis.ticktext = axisData.ZTickLabel;
-scene.xaxis.showline = true;
-scene.yaxis.showline = true;
-scene.zaxis.showline = true;
+ scene.xaxis.zeroline = false;
+ scene.yaxis.zeroline = false;
+ scene.zaxis.zeroline = false;
-scene.xaxis.tickcolor = 'rgba(0,0,0,1)';
-scene.yaxis.tickcolor = 'rgba(0,0,0,1)';
-scene.zaxis.tickcolor = 'rgba(0,0,0,1)';
+ scene.xaxis.showline = true;
+ scene.yaxis.showline = true;
+ scene.zaxis.showline = true;
-scene.xaxis.ticklabelposition = 'outside';
-scene.yaxis.ticklabelposition = 'outside';
-scene.zaxis.ticklabelposition = 'outside';
+ scene.xaxis.tickcolor = 'rgba(0,0,0,1)';
+ scene.yaxis.tickcolor = 'rgba(0,0,0,1)';
+ scene.zaxis.tickcolor = 'rgba(0,0,0,1)';
-scene.xaxis.title = axisData.XLabel.String;
-scene.yaxis.title = axisData.YLabel.String;
-scene.zaxis.title = axisData.ZLabel.String;
+ scene.xaxis.ticklabelposition = 'outside';
+ scene.yaxis.ticklabelposition = 'outside';
+ scene.zaxis.ticklabelposition = 'outside';
-scene.xaxis.tickfont.size = axisData.FontSize;
-scene.yaxis.tickfont.size = axisData.FontSize;
-scene.zaxis.tickfont.size = axisData.FontSize;
+ scene.xaxis.title = axisData.XLabel.String;
+ scene.yaxis.title = axisData.YLabel.String;
+ scene.zaxis.title = axisData.ZLabel.String;
-scene.xaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
-scene.yaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
-scene.zaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
+ scene.xaxis.tickfont.size = axisData.FontSize;
+ scene.yaxis.tickfont.size = axisData.FontSize;
+ scene.zaxis.tickfont.size = axisData.FontSize;
-%-------------------------------------------------------------------------%
+ scene.xaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
+ scene.yaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
+ scene.zaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
-%-SET SCENE TO LAYOUT-%
-obj.layout = setfield(obj.layout, sprintf('scene%d', xsource), scene);
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-SET SCENE TO LAYOUT-%
+ obj.layout = setfield(obj.layout, sprintf('scene%d', xsource), scene);
-%-surface name-%
-obj.data{surfaceIndex}.name = meshData.DisplayName;
-obj.data{contourIndex}.name = meshData.DisplayName;
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-surface name-%
+ obj.data{surfaceIndex}.name = meshData.DisplayName;
+ obj.data{contourIndex}.name = meshData.DisplayName;
-%-surface showscale-%
-obj.data{surfaceIndex}.showscale = false;
-obj.data{contourIndex}.showscale = false;
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-surface showscale-%
+ obj.data{surfaceIndex}.showscale = false;
+ obj.data{contourIndex}.showscale = false;
-%-surface visible-%
-obj.data{surfaceIndex}.visible = strcmp(meshData.Visible,'on');
-obj.data{contourIndex}.visible = strcmp(meshData.Visible,'on');
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-surface visible-%
+ obj.data{surfaceIndex}.visible = strcmp(meshData.Visible,'on');
+ obj.data{contourIndex}.visible = strcmp(meshData.Visible,'on');
-leg = meshData.Annotation;
-legInfo = leg.LegendInformation;
+ %---------------------------------------------------------------------%
-switch legInfo.IconDisplayStyle
- case 'on'
- showleg = true;
- case 'off'
- showleg = false;
-end
+ leg = meshData.Annotation;
+ legInfo = leg.LegendInformation;
-obj.data{surfaceIndex}.showlegend = showleg;
-
-%-------------------------------------------------------------------------%
+ switch legInfo.IconDisplayStyle
+ case 'on'
+ showleg = true;
+ case 'off'
+ showleg = false;
+ end
+ obj.data{surfaceIndex}.showlegend = showleg;
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updatePColor.m b/plotly/plotlyfig_aux/handlegraphics/updatePColor.m
index 8d84b036..b2348a4a 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updatePColor.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updatePColor.m
@@ -1,178 +1,163 @@
function obj = updatePColor(obj, patchIndex)
+ %-AXIS INDEX-%
+ axIndex = obj.getAxisIndex(obj.State.Plot(patchIndex).AssociatedAxis);
-%-AXIS INDEX-%
-axIndex = obj.getAxisIndex(obj.State.Plot(patchIndex).AssociatedAxis);
+ %-PCOLOR DATA STRUCTURE- %
+ pcolor_data = obj.State.Plot(patchIndex).Handle;
+ figure_data = obj.State.Figure.Handle;
-%-PCOLOR DATA STRUCTURE- %
-pcolor_data = obj.State.Plot(patchIndex).Handle;
-figure_data = obj.State.Figure.Handle;
+ %-CHECK FOR MULTIPLE AXES-%
+ [xsource, ysource] = findSourceAxis(obj,axIndex);
-%-CHECK FOR MULTIPLE AXES-%
-[xsource, ysource] = findSourceAxis(obj,axIndex);
+ %-AXIS DATA-%
+ xaxis = obj.layout.("xaxis" + xsource);
+ yaxis = obj.layout.("yaxis" + ysource);
-%-AXIS DATA-%
-xaxis = obj.layout.("xaxis" + xsource);
-yaxis = obj.layout.("yaxis" + ysource);
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-pcolor xaxis and yaxis-%
+ obj.data{patchIndex}.xaxis = ['x' num2str(xsource)];
+ obj.data{patchIndex}.yaxis = ['y' num2str(ysource)];
-%-pcolor xaxis-%
-obj.data{patchIndex}.xaxis = ['x' num2str(xsource)];
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-plot type: surface-%
+ obj.data{patchIndex}.type = 'surface';
-%-pcolor yaxis-%
-obj.data{patchIndex}.yaxis = ['y' num2str(ysource)];
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-format data-%
+ XData = pcolor_data.XData;
+ YData = pcolor_data.YData;
+ ZData = pcolor_data.ZData;
+ CData = pcolor_data.CData;
+ usegrid = false;
-%-plot type: surface-%
-obj.data{patchIndex}.type = 'surface';
-
-%-------------------------------------------------------------------------%
-
-%-format data-%
-XData = pcolor_data.XData;
-YData = pcolor_data.YData;
-ZData = pcolor_data.ZData;
-CData = pcolor_data.CData;
-usegrid = false;
-
-if isvector(XData)
- usegrid = true;
- [XData, YData] = meshgrid(XData, YData);
-end
-
-sizes = [(size(XData, 1)-1)*2, (size(XData, 2)-1)*2];
-xdata = zeros(sizes);
-ydata = zeros(sizes);
-zdata = zeros(sizes);
-cdata = zeros(sizes);
-
-for n = 1:size(XData, 2)-1
- for m = 1:size(XData, 1)-1
-
- % get indices
- n1 = 2*(n-1)+1; m1 = 2*(m-1)+1;
-
- % get surface mesh
- xdata(m1:m1+1,n1:n1+1) = XData(m:m+1, n:n+1);
- ydata(m1:m1+1,n1:n1+1) = YData(m:m+1, n:n+1);
- zdata(m1:m1+1,n1:n1+1) = ZData(m:m+1, n:n+1);
- cdata(m1:m1+1,n1:n1+1) = ones(2,2)*CData(m, n);
+ if isvector(XData)
+ usegrid = true;
+ [XData, YData] = meshgrid(XData, YData);
end
-end
-
-%-------------------------------------------------------------------------%
-
-%-x-data-%
-obj.data{patchIndex}.x = xdata;
-
-%-------------------------------------------------------------------------%
-%-y-data-%
-obj.data{patchIndex}.y = ydata;
-
-%-------------------------------------------------------------------------%
+ sizes = [(size(XData, 1)-1)*2, (size(XData, 2)-1)*2];
+ xdata = zeros(sizes);
+ ydata = zeros(sizes);
+ zdata = zeros(sizes);
+ cdata = zeros(sizes);
+
+ for n = 1:size(XData, 2)-1
+ for m = 1:size(XData, 1)-1
+
+ % get indices
+ n1 = 2*(n-1)+1; m1 = 2*(m-1)+1;
+
+ % get surface mesh
+ xdata(m1:m1+1,n1:n1+1) = XData(m:m+1, n:n+1);
+ ydata(m1:m1+1,n1:n1+1) = YData(m:m+1, n:n+1);
+ zdata(m1:m1+1,n1:n1+1) = ZData(m:m+1, n:n+1);
+ cdata(m1:m1+1,n1:n1+1) = ones(2,2)*CData(m, n);
+ end
+ end
-%-z-data-%
-obj.data{patchIndex}.z = zdata;
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-x,y,z-data-%
+ obj.data{patchIndex}.x = xdata;
+ obj.data{patchIndex}.y = ydata;
+ obj.data{patchIndex}.z = zdata;
-%-coloring-%
-cmap = figure_data.Colormap;
-len = length(cmap)-1;
+ %---------------------------------------------------------------------%
-for c = 1: length(cmap)
- col = 255 * cmap(c, :);
- obj.data{patchIndex}.colorscale{c} = { (c-1)/len , ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')' ] };
-end
-
-obj.data{patchIndex}.surfacecolor = cdata;
-obj.data{patchIndex}.showscale = false;
-obj.data{patchIndex}.cmin = min(CData(:));
-obj.data{patchIndex}.cmax = max(CData(:));
-
-%-------------------------------------------------------------------------%
-
-%-setting grid mesh-%
-if usegrid
- % x-direction
- xmin = min(XData(:));
- xmax = max(XData(:));
- xsize = (xmax - xmin) / (size(XData, 2) - 1);
- obj.data{patchIndex}.contours.x.start = xmin;
- obj.data{patchIndex}.contours.x.end = xmax;
- obj.data{patchIndex}.contours.x.size = xsize;
- obj.data{patchIndex}.contours.x.show = true;
- obj.data{patchIndex}.contours.x.color = 'black';
- % y-direction
- ymin = min(YData(:));
- ymax = max(YData(:));
- ysize = (ymax - ymin) / (size(YData, 2)-1);
- obj.data{patchIndex}.contours.y.start = ymin;
- obj.data{patchIndex}.contours.y.end = ymax;
- obj.data{patchIndex}.contours.y.size = ysize;
- obj.data{patchIndex}.contours.y.show = true;
- obj.data{patchIndex}.contours.y.color = 'black';
-end
+ %-coloring-%
+ cmap = figure_data.Colormap;
+ len = length(cmap)-1;
-%-------------------------------------------------------------------------%
+ for c = 1: length(cmap)
+ col = 255 * cmap(c, :);
+ obj.data{patchIndex}.colorscale{c} = ...
+ {(c-1)/len, sprintf("rgb(%f,%f,%f)", col)};
+ end
-%-aspectratio-%
-obj.layout.scene.aspectratio.x = 12;
-obj.layout.scene.aspectratio.y = 10;
-obj.layout.scene.aspectratio.z = 0.0001;
+ obj.data{patchIndex}.surfacecolor = cdata;
+ obj.data{patchIndex}.showscale = false;
+ obj.data{patchIndex}.cmin = min(CData(:));
+ obj.data{patchIndex}.cmax = max(CData(:));
+
+ %---------------------------------------------------------------------%
+
+ %-setting grid mesh-%
+ if usegrid
+ % x-direction
+ xmin = min(XData(:));
+ xmax = max(XData(:));
+ xsize = (xmax - xmin) / (size(XData, 2) - 1);
+ obj.data{patchIndex}.contours.x.start = xmin;
+ obj.data{patchIndex}.contours.x.end = xmax;
+ obj.data{patchIndex}.contours.x.size = xsize;
+ obj.data{patchIndex}.contours.x.show = true;
+ obj.data{patchIndex}.contours.x.color = 'black';
+ % y-direction
+ ymin = min(YData(:));
+ ymax = max(YData(:));
+ ysize = (ymax - ymin) / (size(YData, 2)-1);
+ obj.data{patchIndex}.contours.y.start = ymin;
+ obj.data{patchIndex}.contours.y.end = ymax;
+ obj.data{patchIndex}.contours.y.size = ysize;
+ obj.data{patchIndex}.contours.y.show = true;
+ obj.data{patchIndex}.contours.y.color = 'black';
+ end
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-camera.eye-%
-obj.layout.scene.camera.eye.x = 0;
-obj.layout.scene.camera.eye.y = -0.5;
-obj.layout.scene.camera.eye.z = 14;
+ %-aspectratio-%
+ obj.layout.scene.aspectratio.x = 12;
+ obj.layout.scene.aspectratio.y = 10;
+ obj.layout.scene.aspectratio.z = 0.0001;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-hide axis-x-%
-obj.layout.scene.xaxis.showticklabels = true;
-obj.layout.scene.xaxis.zeroline = false;
-obj.layout.scene.xaxis.showgrid = false;
-obj.layout.scene.xaxis.title = '';
+ %-camera.eye-%
+ obj.layout.scene.camera.eye.x = 0;
+ obj.layout.scene.camera.eye.y = -0.5;
+ obj.layout.scene.camera.eye.z = 14;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-hide axis-y-%
-obj.layout.scene.yaxis.zeroline = false;
-obj.layout.scene.yaxis.showgrid = false;
-obj.layout.scene.yaxis.showticklabels = true;
-obj.layout.scene.yaxis.title = '';
+ %-hide axis-x-%
+ obj.layout.scene.xaxis.showticklabels = true;
+ obj.layout.scene.xaxis.zeroline = false;
+ obj.layout.scene.xaxis.showgrid = false;
+ obj.layout.scene.xaxis.title = '';
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-hide axis-z-%
-obj.layout.scene.zaxis.title = '';
-obj.layout.scene.zaxis.autotick = false;
-obj.layout.scene.zaxis.zeroline = false;
-obj.layout.scene.zaxis.showline = false;
-obj.layout.scene.zaxis.showticklabels = false;
-obj.layout.scene.zaxis.showgrid = false;
+ %-hide axis-y-%
+ obj.layout.scene.yaxis.zeroline = false;
+ obj.layout.scene.yaxis.showgrid = false;
+ obj.layout.scene.yaxis.showticklabels = true;
+ obj.layout.scene.yaxis.title = '';
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-patch showlegend-%
-leg = pcolor_data.Annotation;
-legInfo = leg.LegendInformation;
+ %-hide axis-z-%
+ obj.layout.scene.zaxis.title = '';
+ obj.layout.scene.zaxis.autotick = false;
+ obj.layout.scene.zaxis.zeroline = false;
+ obj.layout.scene.zaxis.showline = false;
+ obj.layout.scene.zaxis.showticklabels = false;
+ obj.layout.scene.zaxis.showgrid = false;
-switch legInfo.IconDisplayStyle
- case 'on'
- showleg = true;
- case 'off'
- showleg = false;
-end
+ %---------------------------------------------------------------------%
-obj.data{patchIndex}.showlegend = showleg;
+ %-patch showlegend-%
+ leg = pcolor_data.Annotation;
+ legInfo = leg.LegendInformation;
-%-------------------------------------------------------------------------%
+ switch legInfo.IconDisplayStyle
+ case 'on'
+ showleg = true;
+ case 'off'
+ showleg = false;
+ end
+ obj.data{patchIndex}.showlegend = showleg;
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updatePatch.m b/plotly/plotlyfig_aux/handlegraphics/updatePatch.m
index 4a72599d..3f7c8085 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updatePatch.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updatePatch.m
@@ -1,238 +1,227 @@
function obj = updatePatch(obj, patchIndex)
-%----PATCH FIELDS----%
-
-% x - [DONE]
-% y - [DONE]
-% r - [HANDLED BY SCATTER]
-% t - [HANDLED BY SCATTER]
-% mode - [DONE]
-% name - [DONE]
-% text - [NOT SUPPORTED IN MATLAB]
-% error_y - [HANDLED BY ERRORBAR]
-% error_x - [HANDLED BY ERRORBAR]
-% marler.color - [DONE]
-% marker.size - [DONE]
-% marker.line.color - [DONE]
-% marker.line.width - [DONE]
-% marker.line.dash - [NOT SUPPORTED IN MATLAB]
-% marker.line.opacity --- [TODO]
-% marker.line.smoothing - [NOT SUPPORTED IN MATLAB]
-% marker.line.shape - [NOT SUPPORTED IN MATLAB]
-% marker.opacity - [NOT SUPPORTED IN MATLAB]
-% marker.colorscale - [NOT SUPPORTED IN MATLAB]
-% marker.sizemode - [NOT SUPPORTED IN MATLAB]
-% marker.sizeref - [NOT SUPPORTED IN MATLAB]
-% marker.maxdisplayed - [NOT SUPPORTED IN MATLAB]
-% line.color - [DONE]
-% line.width - [DONE]
-% line.dash - [DONE]
-% line.opacity --- [TODO]
-% line.smoothing - [NOT SUPPORTED IN MATLAB]
-% line.shape - [NOT SUPPORTED IN MATLAB]
-% connectgaps - [NOT SUPPORTED IN MATLAB]
-% fill - [HANDLED BY PATCH]
-% fillcolor - [HANDLED BY PATCH]
-% opacity --- [TODO]
-% textfont - [NOT SUPPORTED IN MATLAB]
-% textposition - [NOT SUPPORTED IN MATLAB]
-% xaxis [DONE]
-% yaxis [DONE]
-% showlegend [DONE]
-% stream - [HANDLED BY PLOTLYSTREAM]
-% visible [DONE]
-% type [DONE]
-
-%-AXIS INDEX-%
-axIndex = obj.getAxisIndex(obj.State.Plot(patchIndex).AssociatedAxis);
-
-%-PATCH DATA STRUCTURE- %
-patch_data = obj.State.Plot(patchIndex).Handle;
-
-%-CHECK FOR MULTIPLE AXES-%
-[xsource, ysource] = findSourceAxis(obj,axIndex);
-
-%-AXIS DATA-%
-xaxis = obj.layout.("xaxis" + xsource);
-yaxis = obj.layout.("yaxis" + ysource);
-
-%-------------------------------------------------------------------------%
-
-%-patch xaxis-%
-obj.data{patchIndex}.xaxis = ['x' num2str(xsource)];
-
-%-------------------------------------------------------------------------%
-
-%-patch yaxis-%
-obj.data{patchIndex}.yaxis = ['y' num2str(ysource)];
-
-%-------------------------------------------------------------------------%
-
-%-patch type-%
-if any(nonzeros(patch_data.ZData))
- if obj.PlotOptions.TriangulatePatch
- obj.data{patchIndex}.type = 'mesh3d';
-
- % update the patch data using reducepatch
- patch_data_red = reducepatch(obj.State.Plot(patchIndex).Handle, 1);
-
- else
- obj.data{patchIndex}.type = 'scatter3d';
- end
-else
- obj.data{patchIndex}.type = 'scatter';
-end
+ %----PATCH FIELDS---%
+
+ % x - [DONE]
+ % y - [DONE]
+ % r - [HANDLED BY SCATTER]
+ % t - [HANDLED BY SCATTER]
+ % mode - [DONE]
+ % name - [DONE]
+ % text - [NOT SUPPORTED IN MATLAB]
+ % error_y - [HANDLED BY ERRORBAR]
+ % error_x - [HANDLED BY ERRORBAR]
+ % marler.color - [DONE]
+ % marker.size - [DONE]
+ % marker.line.color - [DONE]
+ % marker.line.width - [DONE]
+ % marker.line.dash - [NOT SUPPORTED IN MATLAB]
+ % marker.line.opacity --- [TODO]
+ % marker.line.smoothing - [NOT SUPPORTED IN MATLAB]
+ % marker.line.shape - [NOT SUPPORTED IN MATLAB]
+ % marker.opacity - [NOT SUPPORTED IN MATLAB]
+ % marker.colorscale - [NOT SUPPORTED IN MATLAB]
+ % marker.sizemode - [NOT SUPPORTED IN MATLAB]
+ % marker.sizeref - [NOT SUPPORTED IN MATLAB]
+ % marker.maxdisplayed - [NOT SUPPORTED IN MATLAB]
+ % line.color - [DONE]
+ % line.width - [DONE]
+ % line.dash - [DONE]
+ % line.opacity --- [TODO]
+ % line.smoothing - [NOT SUPPORTED IN MATLAB]
+ % line.shape - [NOT SUPPORTED IN MATLAB]
+ % connectgaps - [NOT SUPPORTED IN MATLAB]
+ % fill - [HANDLED BY PATCH]
+ % fillcolor - [HANDLED BY PATCH]
+ % opacity --- [TODO]
+ % textfont - [NOT SUPPORTED IN MATLAB]
+ % textposition - [NOT SUPPORTED IN MATLAB]
+ % xaxis [DONE]
+ % yaxis [DONE]
+ % showlegend [DONE]
+ % stream - [HANDLED BY PLOTLYSTREAM]
+ % visible [DONE]
+ % type [DONE]
+
+ %-AXIS INDEX-%
+ axIndex = obj.getAxisIndex(obj.State.Plot(patchIndex).AssociatedAxis);
+
+ %-PATCH DATA STRUCTURE- %
+ patch_data = obj.State.Plot(patchIndex).Handle;
+
+ %-CHECK FOR MULTIPLE AXES-%
+ [xsource, ysource] = findSourceAxis(obj,axIndex);
+
+ %-AXIS DATA-%
+ xaxis = obj.layout.("xaxis" + xsource);
+ yaxis = obj.layout.("yaxis" + ysource);
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-if ~strcmp(obj.data{patchIndex}.type, 'mesh3d')
- %-patch x-%
- xdata = patch_data.XData;
- if isvector(xdata)
- obj.data{patchIndex}.x = [xdata' xdata(1)];
- else
- xtemp = reshape(xdata,[],1);
- xnew = [];
- for n = 1:size(xdata,2)
- xnew = [xnew ; xdata(:,n) ; xdata(1,n); NaN];
- end
- obj.data{patchIndex}.x = xnew;
- end
+ %-patch xaxis and yaxis-%
+ obj.data{patchIndex}.xaxis = ['x' num2str(xsource)];
+ obj.data{patchIndex}.yaxis = ['y' num2str(ysource)];
%---------------------------------------------------------------------%
- %-patch y-%
- ydata = patch_data.YData;
- if isvector(ydata)
- obj.data{patchIndex}.y = [ydata' ydata(1)];
- else
- ytemp = reshape(ydata,[],1);
- ynew = [];
- for n = 1:size(ydata,2)
- ynew = [ynew ; ydata(:,n) ; ydata(1,n); NaN];
+ %-patch type-%
+ if any(nonzeros(patch_data.ZData))
+ if obj.PlotOptions.TriangulatePatch
+ obj.data{patchIndex}.type = 'mesh3d';
+ % update the patch data using reducepatch
+ patch_data_red = reducepatch(obj.State.Plot(patchIndex).Handle, 1);
+ else
+ obj.data{patchIndex}.type = 'scatter3d';
end
- obj.data{patchIndex}.y = ynew;
+ else
+ obj.data{patchIndex}.type = 'scatter';
end
%---------------------------------------------------------------------%
- %-patch z-%
- if any(nonzeros(patch_data.ZData))
- zdata = patch_data.ZData;
+ if ~strcmp(obj.data{patchIndex}.type, 'mesh3d')
+ %-patch x-%
+ xdata = patch_data.XData;
+ if isvector(xdata)
+ obj.data{patchIndex}.x = [xdata' xdata(1)];
+ else
+ xtemp = reshape(xdata,[],1);
+ xnew = [];
+ for n = 1:size(xdata,2)
+ xnew = [xnew ; xdata(:,n) ; xdata(1,n); NaN];
+ end
+ obj.data{patchIndex}.x = xnew;
+ end
+
+ %-----------------------------------------------------------------%
+ %-patch y-%
+ ydata = patch_data.YData;
if isvector(ydata)
- obj.data{patchIndex}.z = [zdata' zdata(1)];
+ obj.data{patchIndex}.y = [ydata' ydata(1)];
else
- ztemp = reshape(zdata,[],1);
- znew = [];
- for n = 1:size(zdata,2)
- znew = [znew ; zdata(:,n) ; zdata(1,n); NaN];
+ ytemp = reshape(ydata,[],1);
+ ynew = [];
+ for n = 1:size(ydata,2)
+ ynew = [ynew ; ydata(:,n) ; ydata(1,n); NaN];
end
- obj.data{patchIndex}.z = znew;
+ obj.data{patchIndex}.y = ynew;
end
- end
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
+
+ %-patch z-%
+ if any(nonzeros(patch_data.ZData))
+ zdata = patch_data.ZData;
+ if isvector(ydata)
+ obj.data{patchIndex}.z = [zdata' zdata(1)];
+ else
+ ztemp = reshape(zdata,[],1);
+ znew = [];
+ for n = 1:size(zdata,2)
+ znew = [znew ; zdata(:,n) ; zdata(1,n); NaN];
+ end
+ obj.data{patchIndex}.z = znew;
+ end
+ end
- %-patch name-%
- obj.data{patchIndex}.name = patch_data.DisplayName;
+ %-----------------------------------------------------------------%
- %---------------------------------------------------------------------%
+ %-patch name-%
+ obj.data{patchIndex}.name = patch_data.DisplayName;
- %-patch visible-%
- obj.data{patchIndex}.visible = strcmp(patch_data.Visible,'on');
+ %-----------------------------------------------------------------%
- %---------------------------------------------------------------------%
+ %-patch visible-%
+ obj.data{patchIndex}.visible = strcmp(patch_data.Visible,'on');
- %-patch fill-%
- obj.data{patchIndex}.fill = 'tozeroy';
+ %-----------------------------------------------------------------%
- %-PATCH MODE-%
- if ~strcmpi('none', patch_data.Marker) && ~strcmpi('none', patch_data.LineStyle)
- mode = 'lines+markers';
- elseif ~strcmpi('none', patch_data.Marker)
- mode = 'markers';
- elseif ~strcmpi('none', patch_data.LineStyle)
- mode = 'lines';
- else
- mode = 'none';
- end
-
- obj.data{patchIndex}.mode = mode;
-
- %---------------------------------------------------------------------%
+ %-patch fill-%
+ obj.data{patchIndex}.fill = 'tozeroy';
- %-patch marker-%
- obj.data{patchIndex}.marker = extractPatchMarker(patch_data);
+ %-PATCH MODE-%
+ if ~strcmpi('none', patch_data.Marker) ...
+ && ~strcmpi('none', patch_data.LineStyle)
+ mode = 'lines+markers';
+ elseif ~strcmpi('none', patch_data.Marker)
+ mode = 'markers';
+ elseif ~strcmpi('none', patch_data.LineStyle)
+ mode = 'lines';
+ else
+ mode = 'none';
+ end
- %---------------------------------------------------------------------%
+ obj.data{patchIndex}.mode = mode;
- %-patch line-%
- obj.data{patchIndex}.line = extractPatchLine(patch_data);
+ %-----------------------------------------------------------------%
- %---------------------------------------------------------------------%
+ %-patch marker-%
+ obj.data{patchIndex}.marker = extractPatchMarker(patch_data);
- %-patch fillcolor-%
- fill = extractPatchFace(patch_data);
+ %-----------------------------------------------------------------%
- if strcmp(obj.data{patchIndex}.type,'scatter')
- obj.data{patchIndex}.fillcolor = fill.color;
- else
- obj.data{patchIndex}.surfacecolor = fill.color;
- end
+ %-patch line-%
+ obj.data{patchIndex}.line = extractPatchLine(patch_data);
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
- %-surfaceaxis-%
- if strcmp(obj.data{patchIndex}.type,'scatter3d')
- minstd = min([std(patch_data.XData) std(patch_data.YData) std(patch_data.ZData)]);
- ind = find([std(patch_data.XData) std(patch_data.YData) std(patch_data.ZData)] == minstd)-1;
- obj.data{patchIndex}.surfaceaxis = ind;
- end
-else
-
- % handle vertices
- x_data = patch_data_red.vertices(:,1);
- y_data = patch_data_red.vertices(:,2);
- z_data = patch_data_red.vertices(:,3);
-
- % specify how vertices connect to form the faces
- i_data = patch_data_red.faces(:,1)-1;
- j_data = patch_data_red.faces(:,2)-1;
- k_data = patch_data_red.faces(:,3)-1;
-
- %-patch x/y/z-%
- obj.data{patchIndex}.x = x_data;
- obj.data{patchIndex}.y = y_data;
- obj.data{patchIndex}.z = z_data;
-
- %-patch i/j/k-%
- obj.data{patchIndex}.i = i_data;
- obj.data{patchIndex}.j = j_data;
- obj.data{patchIndex}.k = k_data;
-
- %-patch fillcolor-%
- fill = extractPatchFace(patch_data);
- obj.data{patchIndex}.color = fill.color;
+ %-patch fillcolor-%
+ fill = extractPatchFace(patch_data);
-end
+ if strcmp(obj.data{patchIndex}.type,'scatter')
+ obj.data{patchIndex}.fillcolor = fill.color;
+ else
+ obj.data{patchIndex}.surfacecolor = fill.color;
+ end
-%-------------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
-%-patch showlegend-%
-leg = patch_data.Annotation;
-legInfo = leg.LegendInformation;
+ %-surfaceaxis-%
+ if strcmp(obj.data{patchIndex}.type,'scatter3d')
+ minstd = min([std(patch_data.XData) std(patch_data.YData) std(patch_data.ZData)]);
+ ind = find([std(patch_data.XData) std(patch_data.YData) std(patch_data.ZData)] == minstd)-1;
+ obj.data{patchIndex}.surfaceaxis = ind;
+ end
+ else
+ % handle vertices
+ x_data = patch_data_red.vertices(:,1);
+ y_data = patch_data_red.vertices(:,2);
+ z_data = patch_data_red.vertices(:,3);
+
+ % specify how vertices connect to form the faces
+ i_data = patch_data_red.faces(:,1)-1;
+ j_data = patch_data_red.faces(:,2)-1;
+ k_data = patch_data_red.faces(:,3)-1;
+
+ %-patch x/y/z-%
+ obj.data{patchIndex}.x = x_data;
+ obj.data{patchIndex}.y = y_data;
+ obj.data{patchIndex}.z = z_data;
+
+ %-patch i/j/k-%
+ obj.data{patchIndex}.i = i_data;
+ obj.data{patchIndex}.j = j_data;
+ obj.data{patchIndex}.k = k_data;
+
+ %-patch fillcolor-%
+ fill = extractPatchFace(patch_data);
+ obj.data{patchIndex}.color = fill.color;
+ end
-switch legInfo.IconDisplayStyle
- case 'on'
- showleg = true;
- case 'off'
- showleg = false;
-end
+ %---------------------------------------------------------------------%
-showleg = showleg & ~isempty(obj.data{patchIndex}.name);
-obj.data{patchIndex}.showlegend = showleg;
+ %-patch showlegend-%
+ leg = patch_data.Annotation;
+ legInfo = leg.LegendInformation;
-%-------------------------------------------------------------------------%
+ switch legInfo.IconDisplayStyle
+ case 'on'
+ showleg = true;
+ case 'off'
+ showleg = false;
+ end
+ showleg = showleg & ~isempty(obj.data{patchIndex}.name);
+ obj.data{patchIndex}.showlegend = showleg;
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updatePie3.m b/plotly/plotlyfig_aux/handlegraphics/updatePie3.m
index e25db4ae..cbe232ae 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updatePie3.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updatePie3.m
@@ -1,371 +1,347 @@
function updatePie3(obj,plotIndex)
+ %-update according to patch or surface-%
+ if strcmpi(obj.State.Plot(plotIndex).Class, 'patch')
+ updatePatchPie3(obj, plotIndex);
+ else
+ updateSurfacePie3(obj, plotIndex);
+ end
+
+ %-hide axis-x-%
+ obj.PlotOptions.scene.xaxis.title = '';
+ obj.PlotOptions.scene.xaxis.autotick = false;
+ obj.PlotOptions.scene.xaxis.zeroline = false;
+ obj.PlotOptions.scene.xaxis.showline = false;
+ obj.PlotOptions.scene.xaxis.showticklabels = false;
+ obj.PlotOptions.scene.xaxis.showgrid = false;
- %-update according to patch or surface-%
- if strcmpi(obj.State.Plot(plotIndex).Class, 'patch')
- updatePatchPie3(obj, plotIndex);
- else
- updateSurfacePie3(obj, plotIndex);
- end
-
- %-hide axis-x-%
- obj.PlotOptions.scene.xaxis.title = '';
- obj.PlotOptions.scene.xaxis.autotick = false;
- obj.PlotOptions.scene.xaxis.zeroline = false;
- obj.PlotOptions.scene.xaxis.showline = false;
- obj.PlotOptions.scene.xaxis.showticklabels = false;
- obj.PlotOptions.scene.xaxis.showgrid = false;
-
- %-hide axis-y-%
- obj.PlotOptions.scene.yaxis.title = '';
- obj.PlotOptions.scene.yaxis.autotick = false;
- obj.PlotOptions.scene.yaxis.zeroline = false;
- obj.PlotOptions.scene.yaxis.showline = false;
- obj.PlotOptions.scene.yaxis.showticklabels = false;
- obj.PlotOptions.scene.yaxis.showgrid = false;
-
- %-hide axis-z-%
- obj.PlotOptions.scene.zaxis.title = '';
- obj.PlotOptions.scene.zaxis.autotick = false;
- obj.PlotOptions.scene.zaxis.zeroline = false;
- obj.PlotOptions.scene.zaxis.showline = false;
- obj.PlotOptions.scene.zaxis.showticklabels = false;
- obj.PlotOptions.scene.zaxis.showgrid = false;
-
- %-put text-%
- obj.data{plotIndex}.hoverinfo = 'text';
- obj.data{plotIndex}.hovertext = obj.PlotOptions.perc;
-
- %-update scene-%
- obj.layout = setfield(obj.layout,['scene' obj.PlotOptions.scene_anchor(end)], obj.PlotOptions.scene);
- obj.data{plotIndex}.scene = obj.PlotOptions.scene_anchor;
- obj.data{plotIndex}.legendgroup = obj.PlotOptions.scene_anchor;
-
- %-update legend-%
- obj.layout.legend.tracegroupgap = 20;
- obj.layout.legend.traceorder = 'grouped';
- obj.layout.legend.bordercolor = 'rgb(200,200,200)';
- obj.layout.legend.x = 0.8;
- obj.layout.legend.y = 0.5;
- obj.layout.legend.borderwidth = 0.5;
+ %-hide axis-y-%
+ obj.PlotOptions.scene.yaxis.title = '';
+ obj.PlotOptions.scene.yaxis.autotick = false;
+ obj.PlotOptions.scene.yaxis.zeroline = false;
+ obj.PlotOptions.scene.yaxis.showline = false;
+ obj.PlotOptions.scene.yaxis.showticklabels = false;
+ obj.PlotOptions.scene.yaxis.showgrid = false;
+ %-hide axis-z-%
+ obj.PlotOptions.scene.zaxis.title = '';
+ obj.PlotOptions.scene.zaxis.autotick = false;
+ obj.PlotOptions.scene.zaxis.zeroline = false;
+ obj.PlotOptions.scene.zaxis.showline = false;
+ obj.PlotOptions.scene.zaxis.showticklabels = false;
+ obj.PlotOptions.scene.zaxis.showgrid = false;
+
+ %-put text-%
+ obj.data{plotIndex}.hoverinfo = 'text';
+ obj.data{plotIndex}.hovertext = obj.PlotOptions.perc;
+
+ %-update scene-%
+ obj.layout = setfield(obj.layout,['scene' ...
+ obj.PlotOptions.scene_anchor(end)], obj.PlotOptions.scene);
+ obj.data{plotIndex}.scene = obj.PlotOptions.scene_anchor;
+ obj.data{plotIndex}.legendgroup = obj.PlotOptions.scene_anchor;
+
+ %-update legend-%
+ obj.layout.legend.tracegroupgap = 20;
+ obj.layout.legend.traceorder = 'grouped';
+ obj.layout.legend.bordercolor = 'rgb(200,200,200)';
+ obj.layout.legend.x = 0.8;
+ obj.layout.legend.y = 0.5;
+ obj.layout.legend.borderwidth = 0.5;
end
-
-%-updatePatchPie3-%
-
function obj = updatePatchPie3(obj, patchIndex)
-
- %-AXIS INDEX-%
- axIndex = obj.getAxisIndex(obj.State.Plot(patchIndex).AssociatedAxis);
-
- %-PATCH DATA STRUCTURE- %
- patch_data = obj.State.Plot(patchIndex).Handle;
-
- %-get the percentage-%
- if ~any(nonzeros(patch_data.ZData))
- t1 = atan2(patch_data.YData(2), patch_data.XData(2));
- t2 = atan2(patch_data.YData(end-1), patch_data.XData(end-1));
-
- a = rad2deg(t2-t1);
- if a < 0
- a = a+360;
+ %-AXIS INDEX-%
+ axIndex = obj.getAxisIndex(obj.State.Plot(patchIndex).AssociatedAxis);
+
+ %-PATCH DATA STRUCTURE- %
+ patch_data = obj.State.Plot(patchIndex).Handle;
+
+ %-get the percentage-%
+ if ~any(nonzeros(patch_data.ZData))
+ t1 = atan2(patch_data.YData(2), patch_data.XData(2));
+ t2 = atan2(patch_data.YData(end-1), patch_data.XData(end-1));
+
+ a = rad2deg(t2-t1);
+ if a < 0
+ a = a+360;
+ end
+
+ obj.PlotOptions.perc = sprintf('%d %%', round(100*a/360));
end
-
- obj.PlotOptions.perc = sprintf('%d %%', round(100*a/360));
- end
- %-CHECK FOR MULTIPLE AXES-%
- [xsource, ysource] = findSourceAxis(obj,axIndex);
+ %-CHECK FOR MULTIPLE AXES-%
+ [xsource, ysource] = findSourceAxis(obj,axIndex);
- %-AXIS DATA-%
- scene = obj.layout.("scene" + xsource);
- obj.PlotOptions.scene_anchor = ['scene' num2str(xsource)];
+ %-AXIS DATA-%
+ scene = obj.layout.("scene" + xsource);
+ obj.PlotOptions.scene_anchor = ['scene' num2str(xsource)];
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
- %-scene to be set-%
- obj.PlotOptions.scene = scene;
+ %-scene to be set-%
+ obj.PlotOptions.scene = scene;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
- %-patch type-%
- obj.data{patchIndex}.type = 'scatter3d';
+ %-patch type-%
+ obj.data{patchIndex}.type = 'scatter3d';
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
- %-patch x-%
- xdata = patch_data.XData;
- if isvector(xdata)
- obj.data{patchIndex}.x = [xdata' xdata(1)];
- else
- xtemp = reshape(xdata,[],1);
- xnew = [];
- for n = 1:size(xdata,2)
- xnew = [xnew ; xdata(:,n) ; xdata(1,n); NaN];
+ %-patch x-%
+ xdata = patch_data.XData;
+ if isvector(xdata)
+ obj.data{patchIndex}.x = [xdata' xdata(1)];
+ else
+ xtemp = reshape(xdata,[],1);
+ xnew = [];
+ for n = 1:size(xdata,2)
+ xnew = [xnew ; xdata(:,n) ; xdata(1,n); NaN];
+ end
+ obj.data{patchIndex}.x = xnew;
end
- obj.data{patchIndex}.x = xnew;
- end
-
- %---------------------------------------------------------------------%
-
- %-patch y-%
- ydata = patch_data.YData;
- if isvector(ydata)
- obj.data{patchIndex}.y = [ydata' ydata(1)];
- else
- ytemp = reshape(ydata,[],1);
- ynew = [];
- for n = 1:size(ydata,2)
- ynew = [ynew ; ydata(:,n) ; ydata(1,n); NaN];
+
+ %---------------------------------------------------------------------%
+
+ %-patch y-%
+ ydata = patch_data.YData;
+ if isvector(ydata)
+ obj.data{patchIndex}.y = [ydata' ydata(1)];
+ else
+ ytemp = reshape(ydata,[],1);
+ ynew = [];
+ for n = 1:size(ydata,2)
+ ynew = [ynew ; ydata(:,n) ; ydata(1,n); NaN];
+ end
+ obj.data{patchIndex}.y = ynew;
end
- obj.data{patchIndex}.y = ynew;
- end
- %---------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
- %-patch z-%
- zdata = patch_data.ZData;
+ %-patch z-%
+ zdata = patch_data.ZData;
- if isvector(ydata)
- obj.data{patchIndex}.z = [zdata' zdata(1)];
- else
- ztemp = reshape(zdata,[],1);
- znew = [];
- for n = 1:size(zdata,2)
- znew = [znew ; zdata(:,n) ; zdata(1,n); NaN];
+ if isvector(ydata)
+ obj.data{patchIndex}.z = [zdata' zdata(1)];
+ else
+ ztemp = reshape(zdata,[],1);
+ znew = [];
+ for n = 1:size(zdata,2)
+ znew = [znew ; zdata(:,n) ; zdata(1,n); NaN];
+ end
+ obj.data{patchIndex}.z = znew;
end
- obj.data{patchIndex}.z = znew;
- end
-
- %---------------------------------------------------------------------%
- %-patch name-%
- if ~isempty(patch_data.DisplayName)
- obj.data{patchIndex}.name = patch_data.DisplayName;
- else
- obj.data{patchIndex}.name = patch_data.DisplayName;
- end
+ %---------------------------------------------------------------------%
- %---------------------------------------------------------------------%
+ %-patch name-%
+ if ~isempty(patch_data.DisplayName)
+ obj.data{patchIndex}.name = patch_data.DisplayName;
+ else
+ obj.data{patchIndex}.name = patch_data.DisplayName;
+ end
- %-patch visible-%
- obj.data{patchIndex}.visible = strcmp(patch_data.Visible,'on');
+ %---------------------------------------------------------------------%
- %---------------------------------------------------------------------%
+ %-patch visible-%
+ obj.data{patchIndex}.visible = strcmp(patch_data.Visible,'on');
- %-patch fill-%
- % obj.data{patchIndex}.fill = 'tozeroy';
+ %---------------------------------------------------------------------%
- %-PATCH MODE-%
- if ~strcmpi('none', patch_data.Marker) && ~strcmpi('none', patch_data.LineStyle)
- mode = 'lines+markers';
- elseif ~strcmpi('none', patch_data.Marker)
- mode = 'markers';
- elseif ~strcmpi('none', patch_data.LineStyle)
- mode = 'lines';
- else
- mode = 'none';
- end
+ %-patch fill-%
+ % obj.data{patchIndex}.fill = 'tozeroy';
- obj.data{patchIndex}.mode = mode;
+ %-PATCH MODE-%
+ if ~strcmpi('none', patch_data.Marker) ...
+ && ~strcmpi('none', patch_data.LineStyle)
+ mode = 'lines+markers';
+ elseif ~strcmpi('none', patch_data.Marker)
+ mode = 'markers';
+ elseif ~strcmpi('none', patch_data.LineStyle)
+ mode = 'lines';
+ else
+ mode = 'none';
+ end
- %---------------------------------------------------------------------%
+ obj.data{patchIndex}.mode = mode;
- %-patch marker-%
- obj.data{patchIndex}.marker = extractPatchMarker(patch_data);
+ %---------------------------------------------------------------------%
- %---------------------------------------------------------------------%
+ %-patch marker-%
+ obj.data{patchIndex}.marker = extractPatchMarker(patch_data);
- %-patch line-%
- obj.data{patchIndex}.line = extractPatchLine(patch_data);
+ %---------------------------------------------------------------------%
- %---------------------------------------------------------------------%
+ %-patch line-%
+ obj.data{patchIndex}.line = extractPatchLine(patch_data);
- %-patch fillcolor-%
- fill = extractPatchFace(patch_data);
- obj.data{patchIndex}.surfacecolor = fill.color;
+ %---------------------------------------------------------------------%
- if zdata(1) == 0
- obj.data{patchIndex}.line.width = 3;
- obj.data{patchIndex}.line.color = fill.color;
- end
+ %-patch fillcolor-%
+ fill = extractPatchFace(patch_data);
+ obj.data{patchIndex}.surfacecolor = fill.color;
- %---------------------------------------------------------------------%
+ if zdata(1) == 0
+ obj.data{patchIndex}.line.width = 3;
+ obj.data{patchIndex}.line.color = fill.color;
+ end
- %-surfaceaxis-%
- minstd = min([std(patch_data.XData) std(patch_data.YData) std(patch_data.ZData)]);
- ind = find([std(patch_data.XData) std(patch_data.YData) std(patch_data.ZData)] == minstd)-1;
- obj.data{patchIndex}.surfaceaxis = ind;
+ %---------------------------------------------------------------------%
- %-------------------------------------------------------------------------%
+ %-surfaceaxis-%
+ minstd = min([std(patch_data.XData) std(patch_data.YData) std(patch_data.ZData)]);
+ ind = find([std(patch_data.XData) std(patch_data.YData) std(patch_data.ZData)] == minstd)-1;
+ obj.data{patchIndex}.surfaceaxis = ind;
- %-patch showlegend-%
- leg = patch_data.Annotation;
- legInfo = leg.LegendInformation;
+ %---------------------------------------------------------------------%
- switch legInfo.IconDisplayStyle
- case 'on'
- showleg = true;
- case 'off'
- showleg = false;
- end
+ %-patch showlegend-%
+ leg = patch_data.Annotation;
+ legInfo = leg.LegendInformation;
- obj.data{patchIndex}.showlegend = showleg;
+ switch legInfo.IconDisplayStyle
+ case 'on'
+ showleg = true;
+ case 'off'
+ showleg = false;
+ end
- %-------------------------------------------------------------------------%
+ obj.data{patchIndex}.showlegend = showleg;
end
-
-
function obj = updateSurfacePie3(obj, surfaceIndex)
+ %-AXIS INDEX-%
+ axIndex = obj.getAxisIndex(obj.State.Plot(surfaceIndex).AssociatedAxis);
- %-AXIS INDEX-%
- axIndex = obj.getAxisIndex(obj.State.Plot(surfaceIndex).AssociatedAxis);
-
- %-CHECK FOR MULTIPLE AXES-%
- [xsource, ysource] = findSourceAxis(obj,axIndex);
-
- %-SURFACE DATA STRUCTURE- %
- image_data = obj.State.Plot(surfaceIndex).Handle;
- figure_data = obj.State.Figure.Handle;
-
- %-AXIS DATA-%
- scene = obj.layout.("scene" + xsource);
- obj.PlotOptions.scene_anchor = ['scene' num2str(xsource)];
-
- %-------------------------------------------------------------------------%
-
- %-surface type-%
- obj.data{surfaceIndex}.type = 'surface';
-
- %------------------------------------------------------------------------%
-
- %-surface x-%
- obj.data{surfaceIndex}.x = image_data.XData;
-
- %------------------------------------------------------------------------%
-
- %-surface y-%
- obj.data{surfaceIndex}.y = image_data.YData;
-
- %------------------------------------------------------------------------%
-
- %-surface z-%
- obj.data{surfaceIndex}.z = image_data.ZData;
-
- %------------------------------------------------------------------------%
-
- %-image colorscale-%
-
- cmap = figure_data.Colormap;
- len = length(cmap)-1;
-
- for c = 1:length(cmap)
- col = 255 * cmap(c, :);
- obj.data{surfaceIndex}.colorscale{c} = { (c-1)/len , ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')' ] };
- end
-
- obj.data{surfaceIndex}.surfacecolor = 255*(image_data.CData-1) / (obj.PlotOptions.nbars{xsource} - 1);
- obj.data{surfaceIndex}.cmax = 255;
- obj.data{surfaceIndex}.cmin = 0;
-
- %------------------------------------------------------------------------%
-
- %-get data-%
- xdata = image_data.XData;
- ydata = image_data.YData;
-
- %-aspect ratio-%
- ar = obj.PlotOptions.AspectRatio;
-
- if ~isempty(ar)
- if ischar(ar)
- scene.aspectmode = ar;
- elseif isvector(ar) && length(ar) == 3
- xar = ar(1);
- yar = ar(2);
- zar = ar(3);
- end
- else
+ %-CHECK FOR MULTIPLE AXES-%
+ [xsource, ysource] = findSourceAxis(obj,axIndex);
- %-define as default-%
- xar = max(xdata(:));
- yar = max(ydata(:));
- zar = max([xar, yar]);
- end
+ %-SURFACE DATA STRUCTURE- %
+ image_data = obj.State.Plot(surfaceIndex).Handle;
+ figure_data = obj.State.Figure.Handle;
- fac1 = 0.75;
- fac2 = 0.175;
- nax = length(obj.PlotOptions.nbars);
+ %-AXIS DATA-%
+ scene = obj.layout.("scene" + xsource);
+ obj.PlotOptions.scene_anchor = ['scene' num2str(xsource)];
- scene.aspectratio.x = xar + fac1*(nax-1)*xar;
- scene.aspectratio.y = yar + fac1*(nax-1)*yar;
- scene.aspectratio.z = (zar + fac1*(nax-1)*zar)*fac2;
+ %---------------------------------------------------------------------%
- % optional equations
- % scene.aspectratio.x = xar*(1+fac1);
- % scene.aspectratio.y = yar*(1+fac1);
- % scene.aspectratio.z = zar*fac2*(1+fac1);
+ obj.data{surfaceIndex}.type = 'surface';
+ obj.data{surfaceIndex}.x = image_data.XData;
+ obj.data{surfaceIndex}.y = image_data.YData;
+ obj.data{surfaceIndex}.z = image_data.ZData;
- %---------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
- %-camera eye-%
- ey = obj.PlotOptions.CameraEye;
+ %-image colorscale-%
- if ~isempty(ey)
- if isvector(ey) && length(ey) == 3
- scene.camera.eye.x = ey(1);
- scene.camera.eye.y = ey(2);
- scene.camera.eye.z = ey(3);
+ cmap = figure_data.Colormap;
+ len = length(cmap)-1;
+
+ for c = 1:length(cmap)
+ col = 255 * cmap(c, :);
+ obj.data{surfaceIndex}.colorscale{c} = ...
+ {(c-1)/len, sprintf("rgb(%f,%f,%f)", col)};
end
- else
- %-define as default-%
- xey = - xar; if xey>0 xfac = -0.2; else xfac = 0.2; end
- yey = - yar; if yey>0 yfac = -0.2; else yfac = 0.2; end
- if zar>0 zfac = 0.2; else zfac = -0.2; end
-
- scene.camera.eye.x = xey + xfac*xey;
- scene.camera.eye.y = yey + yfac*yey;
- scene.camera.eye.z = zar + zfac*zar;
- end
+ obj.data{surfaceIndex}.surfacecolor = ...
+ 255*(image_data.CData-1) / (obj.PlotOptions.nbars{xsource} - 1);
+ obj.data{surfaceIndex}.cmax = 255;
+ obj.data{surfaceIndex}.cmin = 0;
+
+ %---------------------------------------------------------------------%
+
+ %-get data-%
+ xdata = image_data.XData;
+ ydata = image_data.YData;
+
+ %-aspect ratio-%
+ ar = obj.PlotOptions.AspectRatio;
+
+ if ~isempty(ar)
+ if ischar(ar)
+ scene.aspectmode = ar;
+ elseif isvector(ar) && length(ar) == 3
+ xar = ar(1);
+ yar = ar(2);
+ zar = ar(3);
+ end
+ else
+ %-define as default-%
+ xar = max(xdata(:));
+ yar = max(ydata(:));
+ zar = max([xar, yar]);
+ end
- %-------------------------------------------------------------------------%
+ fac1 = 0.75;
+ fac2 = 0.175;
+ nax = length(obj.PlotOptions.nbars);
+
+ scene.aspectratio.x = xar + fac1*(nax-1)*xar;
+ scene.aspectratio.y = yar + fac1*(nax-1)*yar;
+ scene.aspectratio.z = (zar + fac1*(nax-1)*zar)*fac2;
+
+ % optional equations
+ % scene.aspectratio.x = xar*(1+fac1);
+ % scene.aspectratio.y = yar*(1+fac1);
+ % scene.aspectratio.z = zar*fac2*(1+fac1);
+
+ %---------------------------------------------------------------------%
+
+ %-camera eye-%
+ ey = obj.PlotOptions.CameraEye;
+
+ if ~isempty(ey)
+ if isvector(ey) && length(ey) == 3
+ scene.camera.eye.x = ey(1);
+ scene.camera.eye.y = ey(2);
+ scene.camera.eye.z = ey(3);
+ end
+ else
+
+ %-define as default-%
+ xey = - xar; if xey>0 xfac = -0.2; else xfac = 0.2; end
+ yey = - yar; if yey>0 yfac = -0.2; else yfac = 0.2; end
+ if zar>0 zfac = 0.2; else zfac = -0.2; end
+
+ scene.camera.eye.x = xey + xfac*xey;
+ scene.camera.eye.y = yey + yfac*yey;
+ scene.camera.eye.z = zar + zfac*zar;
+ end
- %-scene to be set-%
- obj.PlotOptions.scene = scene;
+ %---------------------------------------------------------------------%
- %-------------------------------------------------------------------------%
+ %-scene to be set-%
+ obj.PlotOptions.scene = scene;
- %-surface name-%
- obj.data{surfaceIndex}.name = image_data.DisplayName;
- obj.data{surfaceIndex-1}.name = image_data.DisplayName;
+ %---------------------------------------------------------------------%
- %-------------------------------------------------------------------------%
+ %-surface name-%
+ obj.data{surfaceIndex}.name = image_data.DisplayName;
+ obj.data{surfaceIndex-1}.name = image_data.DisplayName;
- %-surface showscale-%
- obj.data{surfaceIndex}.showscale = false;
+ %---------------------------------------------------------------------%
- %-------------------------------------------------------------------------%
+ %-surface showscale-%
+ obj.data{surfaceIndex}.showscale = false;
- %-surface visible-%
- obj.data{surfaceIndex}.visible = strcmp(image_data.Visible,'on');
+ %---------------------------------------------------------------------%
- %-------------------------------------------------------------------------%
+ %-surface visible-%
+ obj.data{surfaceIndex}.visible = strcmp(image_data.Visible,'on');
- leg = image_data.Annotation;
- legInfo = leg.LegendInformation;
+ %---------------------------------------------------------------------%
- switch legInfo.IconDisplayStyle
- case 'on'
- showleg = true;
- case 'off'
- showleg = false;
- end
+ leg = image_data.Annotation;
+ legInfo = leg.LegendInformation;
- obj.data{surfaceIndex-1}.showlegend = showleg;
- obj.data{surfaceIndex}.showlegend = false;
+ switch legInfo.IconDisplayStyle
+ case 'on'
+ showleg = true;
+ case 'off'
+ showleg = false;
+ end
- %-------------------------------------------------------------------------%
+ obj.data{surfaceIndex-1}.showlegend = showleg;
+ obj.data{surfaceIndex}.showlegend = false;
end
-
diff --git a/plotly/plotlyfig_aux/handlegraphics/updatePolarplot.m b/plotly/plotlyfig_aux/handlegraphics/updatePolarplot.m
index 0775171d..8df8836d 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updatePolarplot.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updatePolarplot.m
@@ -12,7 +12,7 @@ function updatePolarplot(obj, plotIndex)
%-ASSOCIATE POLAR-AXES LAYOUT-%
obj.data{plotIndex}.subplot = sprintf('polar%d', xsource+1);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-parse plot data-%
rData = plotData.RData;
@@ -21,23 +21,24 @@ function updatePolarplot(obj, plotIndex)
thetaData(rData<0) = mod(thetaData(rData<0)+180, 360);
rData = abs(rData);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-scatterpolar trace setting-%
obj.data{plotIndex}.type = 'scatterpolar';
obj.data{plotIndex}.visible = strcmp(plotData.Visible,'on');
obj.data{plotIndex}.name = plotData.DisplayName;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set scatterpolar data-%
obj.data{plotIndex}.r = rData;
obj.data{plotIndex}.theta = thetaData;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-trace settings-%
- if ~strcmpi('none', plotData.Marker) && ~strcmpi('none', plotData.LineStyle)
+ if ~strcmpi('none', plotData.Marker) ...
+ && ~strcmpi('none', plotData.LineStyle)
obj.data{plotIndex}.mode = 'lines+markers';
elseif ~strcmpi('none', plotData.Marker)
obj.data{plotIndex}.mode = 'markers';
@@ -51,7 +52,7 @@ function updatePolarplot(obj, plotIndex)
obj.data{plotIndex}.line = extractLineLine(plotData);
obj.data{plotIndex}.line.width = 2 * obj.data{plotIndex}.line.width;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-legend setting-%
leg = plotData.Annotation;
@@ -64,15 +65,12 @@ function updatePolarplot(obj, plotIndex)
obj.data{plotIndex}.showlegend = false;
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set polar axes-%
updatePolaraxes(obj, plotIndex)
-
- %-------------------------------------------------------------------------%
end
-
%-------------------------------------------------------------------------%
%
%-SET POLAR AXIS-%
@@ -80,9 +78,6 @@ function updatePolarplot(obj, plotIndex)
%-------------------------------------------------------------------------%
function updatePolaraxes(obj, plotIndex)
-
- %-------------------------------------------------------------------------%
-
%-AXIS INDEX-%
axIndex = obj.getAxisIndex(obj.State.Plot(plotIndex).AssociatedAxis);
@@ -95,7 +90,7 @@ function updatePolaraxes(obj, plotIndex)
thetaAxis = axisData.ThetaAxis;
rAxis = axisData.RAxis;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set domain plot-%
xo = axisData.Position(1);
@@ -106,7 +101,7 @@ function updatePolaraxes(obj, plotIndex)
polarAxis.domain.x = min([xo xo + w], 1);
polarAxis.domain.y = min([yo yo + h], 1);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-setting angular axis-%
gridColor = sprintf('rgba(%f,%f,%f,%f)', 255*axisData.GridColor, ...
@@ -128,7 +123,7 @@ function updatePolaraxes(obj, plotIndex)
polarAxis.angularaxis.gridcolor = gridColor;
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set angular axis label-%
thetaLabel = thetaAxis.Label;
@@ -140,7 +135,7 @@ function updatePolaraxes(obj, plotIndex)
polarAxis.radialaxis.title.font.color = sprintf('rgb(%f,%f,%f)', ...
255*thetaLabel.Color);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-setting radial axis-%
rLim = rAxis.Limits;
@@ -161,7 +156,7 @@ function updatePolaraxes(obj, plotIndex)
polarAxis.radialaxis.gridcolor = gridColor;
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set radial axis label-%
rLabel = thetaAxis.Label;
@@ -173,7 +168,7 @@ function updatePolaraxes(obj, plotIndex)
polarAxis.angularaxis.title.font.color = sprintf('rgb(%f,%f,%f)', ...
255*rLabel.Color);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-angular tick labels settings-%
tickValues = axisData.ThetaTick;
@@ -218,8 +213,7 @@ function updatePolaraxes(obj, plotIndex)
255*thetaAxis.Color);
end
-
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-radial tick labels settings-%
tickValues = axisData.RTick;
@@ -255,11 +249,8 @@ function updatePolaraxes(obj, plotIndex)
255*rAxis.Color);
end
-
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set polaraxes to layout-%
obj.layout = setfield(obj.layout, sprintf('polar%d', xsource+1), polarAxis);
-
- %-------------------------------------------------------------------------%
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateQuiver.m b/plotly/plotlyfig_aux/handlegraphics/updateQuiver.m
index 01e0842c..eddb70dd 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateQuiver.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateQuiver.m
@@ -1,7 +1,4 @@
function obj = updateQuiver(obj, dataIndex)
-
- %-------------------------------------------------------------------------%
-
%-INITIALIZATIONS-%
%-get structures-%
@@ -32,7 +29,7 @@
%-update axis-%
if isQuiver3D, updateScene(obj, dataIndex); end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set trace-%
if isQuiver3D
@@ -48,7 +45,7 @@
obj.data{dataIndex}.visible = strcmp(plotData.Visible,'on');
obj.data{dataIndex}.name = plotData.DisplayName;
- %------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-quiver line color-%
lineColor = 255 * plotData.Color;
@@ -57,13 +54,12 @@
%-quiver line width-%
obj.data{dataIndex}.line.width = 2.5 * plotData.LineWidth;
- %------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set trace data for quiver line only-%
m = 1;
for n = 1:numel(xData)
-
obj.data{dataIndex}.x(m) = xData(n);
obj.data{dataIndex}.x(m+1) = xData(n) + uData(n);
obj.data{dataIndex}.x(m+2) = nan;
@@ -77,20 +73,16 @@
obj.data{dataIndex}.z(m+1) = zData(n) + wData(n);
obj.data{dataIndex}.z(m+2) = nan;
end
-
m = m + 3;
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set trace data for quiver barb-%
if isHG2() && strcmp(plotData.ShowArrowHead, 'on')
-
maxHeadSize = plotData.MaxHeadSize * 1.5;
headWidth = 20;
-
for n = 1:numel(xData)
-
if isQuiver3D
quiverBarb = getQuiverBarb3D(...
xData(n), yData(n), zData(n), ...
@@ -104,11 +96,9 @@
maxHeadSize, headWidth ...
);
end
-
for m = 1:size(quiverBarb, 2)
obj.data{dataIndex}.x(end+1) = quiverBarb(1, m);
obj.data{dataIndex}.y(end+1) = quiverBarb(2, m);
-
if isQuiver3D
obj.data{dataIndex}.z(end+1) = quiverBarb(3, m);
end
@@ -116,7 +106,7 @@
end
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set trace legend-%
leg = plotData.Annotation;
@@ -130,14 +120,9 @@
end
obj.data{dataIndex}.showlegend = showLeg;
-
- %-------------------------------------------------------------------------%
end
function updateScene(obj, dataIndex)
-
- %-------------------------------------------------------------------------%
-
%-INITIALIZATIONS-%
axIndex = obj.getAxisIndex(obj.State.Plot(dataIndex).AssociatedAxis);
plotData = obj.State.Plot(dataIndex).Handle;
@@ -164,7 +149,7 @@ function updateScene(obj, dataIndex)
r3 = range([ 1, prod(aspectRatio([2,3])) ]);
r = max([r1, r2, r3]);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-aspect ratio-%
scene.aspectratio.x = 1.0*aspectRatio(1);
@@ -184,7 +169,7 @@ function updateScene(obj, dataIndex)
%-camera projection-%
% scene.camera.projection.type = axisData.Projection;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-scene axis configuration-%
rangeFac = 0.0;
@@ -240,24 +225,17 @@ function updateScene(obj, dataIndex)
if strcmp(axisData.YGrid, 'off'), scene.yaxis.showgrid = false; end
if strcmp(axisData.ZGrid, 'off'), scene.zaxis.showgrid = false; end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-SET SCENE TO LAYOUT-%
obj.layout = setfield(obj.layout, sprintf('scene%d', xSource), scene);
-
- %-------------------------------------------------------------------------%
end
-
-
function quiverBarb = getQuiverBarb2D(...
xData, yData, ...
uData, vData, ...
maxHeadSize, headWidth ...
)
-
- %-------------------------------------------------------------------------%
-
%-initializations-%
refVector = [uData; vData];
@@ -272,15 +250,12 @@ function updateScene(obj, dataIndex)
yHead = yData + vData;
head = [xHead; yHead];
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
quiverBarb = getBarb2D(head, refAngle, refLen, maxHeadSize, headWidth);
-
- %-------------------------------------------------------------------------%
end
function barb = getBarb2D(head, refAngle, refLen, maxHeadSize, headWidth)
-
refPoint = -maxHeadSize * refLen * cos(refAngle');
rotPoint1 = rotation2D(refPoint, deg2rad(headWidth));
rotPoint2 = rotation2D(refPoint, deg2rad(-headWidth));
@@ -293,7 +268,6 @@ function updateScene(obj, dataIndex)
function outPoint = translation2D(inPoint, offsetPoint)
xt = offsetPoint(1); yt = offsetPoint(2);
-
T = affine2d(...
[...
1 , 0 , 0; ...
@@ -301,7 +275,6 @@ function updateScene(obj, dataIndex)
xt, yt, 1 ...
]...
);
-
outPoint = transformPointsForward(T, inPoint);
end
@@ -313,20 +286,14 @@ function updateScene(obj, dataIndex)
0 , 0 , 1; ...
]...
);
-
outPoint = transformPointsForward(T, inPoint);
end
-
-
function quiverBarb = getQuiverBarb3D(...
xData, yData, zData, ...
uData, vData, wData, ...
maxHeadSize, headWidth, barbMode ...
)
-
- %-------------------------------------------------------------------------%
-
%-initializations-%
refVector = [uData; vData; wData];
@@ -343,7 +310,7 @@ function updateScene(obj, dataIndex)
zHead = zData + wData;
head = [xHead; yHead; zHead];
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
xBarb = getBarb3D(head, refAngle, refLen, maxHeadSize, headWidth, 'x');
yBarb = getBarb3D(head, refAngle, refLen, maxHeadSize, headWidth, 'y');
@@ -356,13 +323,10 @@ function updateScene(obj, dataIndex)
quiverBarb2 = mean([xBarb(:,3), yBarb(:,3), zBarb(:,3)], 2);
quiverBarb = [quiverBarb1, xBarb(:,2), quiverBarb2, xBarb(:,4)];
end
-
- %-------------------------------------------------------------------------%
end
function barb = getBarb3D(head, refAngle, refLen, maxHeadSize, headWidth, ...
- refAxis)
-
+ refAxis)
refPoint = -maxHeadSize * refLen * cos(refAngle');
rotPoint1 = rotation3D(refPoint, deg2rad(headWidth), refAxis);
rotPoint2 = rotation3D(refPoint, deg2rad(-headWidth), refAxis);
@@ -375,7 +339,6 @@ function updateScene(obj, dataIndex)
function outPoint = translation3D(inPoint, offsetPoint)
xt = offsetPoint(1); yt = offsetPoint(2); zt = offsetPoint(3);
-
T = affine3d(...
[...
1 , 0 , 0 , 0; ...
@@ -384,7 +347,6 @@ function updateScene(obj, dataIndex)
xt, yt, zt, 1 ...
]...
);
-
outPoint = transformPointsForward(T, inPoint);
end
@@ -421,14 +383,10 @@ function updateScene(obj, dataIndex)
]...
);
end
-
outPoint = transformPointsForward(T, inPoint);
end
-
-
function scaleFactor = getScaleFactor(xData, uData, nSteps)
-
xStep = max( abs(diff( mean(xData(:,:,1), 1) )) );
uStep = max(abs(uData(:)));
@@ -436,6 +394,5 @@ function updateScene(obj, dataIndex)
end
function stringColor = getStringColor(numColor)
-
stringColor = sprintf('rgb(%f,%f,%f)', numColor);
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateQuivergroup.m b/plotly/plotlyfig_aux/handlegraphics/updateQuivergroup.m
index 990cd76c..96b9a595 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateQuivergroup.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateQuivergroup.m
@@ -1,45 +1,27 @@
function obj = updateQuivergroup(obj, quiverIndex)
-
-%-store original stair handle-%
-quiver_group = obj.State.Plot(quiverIndex).Handle;
-
-%------------------------------------------------------------------------%
-
-%-get children-%
-quiver_child = quiver_group.Children;
-
-%------------------------------------------------------------------------%
-
-%xdata
-xdata = [];
-
-%ydata
-ydata = [];
-
-%iterate through first two children (the vector line + arrow head)
-for n = 1:2;
-
-%-update line -%
-obj.State.Plot(quiverIndex).Handle = quiver_child(n);
-updateLineseries(obj,quiverIndex);
-
-%update xdata
-xdata = [xdata obj.data{quiverIndex}.x];
-
-%update ydata
-ydata = [ydata obj.data{quiverIndex}.y];
-
-end
-
-%------------------------------------------------------------------------%
-
-% store the final data vector
-obj.data{quiverIndex}.x = xdata;
-obj.data{quiverIndex}.y = ydata;
-
-%------------------------------------------------------------------------%
-
-%-revert handle-%
-obj.State.Plot(quiverIndex).Handle = quiver_group;
-
+ %-store original stair handle-%
+ quiver_group = obj.State.Plot(quiverIndex).Handle;
+
+ %-get children-%
+ quiver_child = quiver_group.Children;
+
+ xdata = [];
+ ydata = [];
+ %iterate through first two children (the vector line + arrow head)
+ for n = 1:2;
+ %-update line -%
+ obj.State.Plot(quiverIndex).Handle = quiver_child(n);
+ updateLineseries(obj,quiverIndex);
+
+ %update xdata and ydata
+ xdata = [xdata obj.data{quiverIndex}.x];
+ ydata = [ydata obj.data{quiverIndex}.y];
+ end
+
+ % store the final data vector
+ obj.data{quiverIndex}.x = xdata;
+ obj.data{quiverIndex}.y = ydata;
+
+ %-revert handle-%
+ obj.State.Plot(quiverIndex).Handle = quiver_group;
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateRectangle.m b/plotly/plotlyfig_aux/handlegraphics/updateRectangle.m
index 62769f02..86156a66 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateRectangle.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateRectangle.m
@@ -1,124 +1,94 @@
function obj = updateRectangle(obj, rectIndex)
-
-%----RECTANGLE FIELDS----%
-
-% x - [DONE]
-% y - [DONE]
-% mode - [DONE]
-% name - [DONE]
-% text - [NOT SUPPORTED IN MATLAB]
-% error_y - [HANDLED BY ERRORBAR]
-% error_x - [HANDLED BY ERRORBAR]
-% line.color - [DONE]
-% line.width - [DONE]
-% line.dash - [DONE]
-% line.opacity - [NOT SUPPORTED IN MATLAB]
-% line.smoothing - [NOT SUPPORTED IN MATLAB]
-% line.shape - [NOT SUPPORTED IN MATLAB]
-% connectgaps - [NOT SUPPORTED IN MATLAB]
-% fill - [HANDLED BY RECTANGLE]
-% fillcolor - [HANDLED BY RECTANGLE]
-% opacity - [NOT SUPPORTED IN MATLAB]
-% textfont - [NOT SUPPORTED IN MATLAB]
-% textposition - [NOT SUPPORTED IN MATLAB]
-% xaxis [DONE]
-% yaxis [DONE]
-% showlegend [DONE]
-% stream - [HANDLED BY PLOTLYSTREAM]
-% visible [DONE]
-% type [DONE]
-
-%-AXIS INDEX-%
-axIndex = obj.getAxisIndex(obj.State.Plot(rectIndex).AssociatedAxis);
-
-%-RECTANGLE DATA STRUCTURE- %
-rect_data = obj.State.Plot(rectIndex).Handle;
-
-%-CHECK FOR MULTIPLE AXES-%
-[xsource, ysource] = findSourceAxis(obj,axIndex);
-
-%-AXIS DATA-%
-xaxis = obj.layout.("xaxis" + xsource);
-yaxis = obj.layout.("yaxis" + ysource);
-
-%-------------------------------------------------------------------------%
-
-%-rectangle xaxis-%
-obj.data{rectIndex}.xaxis = ['x' num2str(xsource)];
-
-%-------------------------------------------------------------------------%
-
-%-rectangle yaxis-%
-obj.data{rectIndex}.yaxis = ['y' num2str(ysource)];
-
-%-------------------------------------------------------------------------%
-
-%-rectangle type-%
-obj.data{rectIndex}.type = 'scatter';
-
-%-------------------------------------------------------------------------%
-
-%-rectangle x-%
-obj.data{rectIndex}.x = [rect_data.Position(1) rect_data.Position(1) ...
- rect_data.Position(1) + rect_data.Position(3) ...
- rect_data.Position(1) + rect_data.Position(3) ...
- rect_data.Position(1)];
-
-%-------------------------------------------------------------------------%
-
-%-rectangle y-%
-obj.data{rectIndex}.y = [rect_data.Position(2) rect_data.Position(2) + rect_data.Position(4) ...
- rect_data.Position(2) + rect_data.Position(4) ...
- rect_data.Position(2) ...
- rect_data.Position(2)];
-
-%-------------------------------------------------------------------------%
-
-%-rectangle name-%
-obj.data{rectIndex}.name = rect_data.DisplayName;
-
-%-------------------------------------------------------------------------%
-
-%-rectangle mode-%
-obj.data{rectIndex}.mode = 'lines';
-
-%-------------------------------------------------------------------------%
-
-%-rectangle fill-%
-obj.data{rectIndex}.visible = strcmp(rect_data.Visible,'on');
-
-
-%-------------------------------------------------------------------------%
-
-%-rectangle fill-%
-obj.data{rectIndex}.fill = 'tonexty';
-
-%-------------------------------------------------------------------------%
-
-%-rectangle line-%
-obj.data{rectIndex}.line = extractPatchLine(rect_data);
-
-%-------------------------------------------------------------------------%
-
-%-rectangle fillcolor-%
-fill = extractPatchFace(rect_data);
-obj.data{rectIndex}.fillcolor = fill.color;
-
-%-------------------------------------------------------------------------%
-
-%-rectangle showlegend-%
-leg = rect_data.Annotation;
-legInfo = leg.LegendInformation;
-
-switch legInfo.IconDisplayStyle
- case 'on'
- showleg = true;
- case 'off'
- showleg = false;
-end
-
-obj.data{rectIndex}.showlegend = showleg;
-
-%-------------------------------------------------------------------------%
-
+ %----RECTANGLE FIELDS----%
+
+ % x - [DONE]
+ % y - [DONE]
+ % mode - [DONE]
+ % name - [DONE]
+ % text - [NOT SUPPORTED IN MATLAB]
+ % error_y - [HANDLED BY ERRORBAR]
+ % error_x - [HANDLED BY ERRORBAR]
+ % line.color - [DONE]
+ % line.width - [DONE]
+ % line.dash - [DONE]
+ % line.opacity - [NOT SUPPORTED IN MATLAB]
+ % line.smoothing - [NOT SUPPORTED IN MATLAB]
+ % line.shape - [NOT SUPPORTED IN MATLAB]
+ % connectgaps - [NOT SUPPORTED IN MATLAB]
+ % fill - [HANDLED BY RECTANGLE]
+ % fillcolor - [HANDLED BY RECTANGLE]
+ % opacity - [NOT SUPPORTED IN MATLAB]
+ % textfont - [NOT SUPPORTED IN MATLAB]
+ % textposition - [NOT SUPPORTED IN MATLAB]
+ % xaxis [DONE]
+ % yaxis [DONE]
+ % showlegend [DONE]
+ % stream - [HANDLED BY PLOTLYSTREAM]
+ % visible [DONE]
+ % type [DONE]
+
+ %-AXIS INDEX-%
+ axIndex = obj.getAxisIndex(obj.State.Plot(rectIndex).AssociatedAxis);
+
+ %-RECTANGLE DATA STRUCTURE- %
+ rect_data = obj.State.Plot(rectIndex).Handle;
+
+ %-CHECK FOR MULTIPLE AXES-%
+ [xsource, ysource] = findSourceAxis(obj,axIndex);
+
+ %-AXIS DATA-%
+ xaxis = obj.layout.("xaxis" + xsource);
+ yaxis = obj.layout.("yaxis" + ysource);
+
+ %---------------------------------------------------------------------%
+
+ %-rectangle xaxis and yaxis-%
+ obj.data{rectIndex}.xaxis = ['x' num2str(xsource)];
+ obj.data{rectIndex}.yaxis = ['y' num2str(ysource)];
+
+ %---------------------------------------------------------------------%
+
+ %-rectangle type-%
+ obj.data{rectIndex}.type = 'scatter';
+
+ %---------------------------------------------------------------------%
+
+ %-rectangle x-%
+ obj.data{rectIndex}.x = [rect_data.Position(1) rect_data.Position(1) ...
+ rect_data.Position(1) + rect_data.Position(3) ...
+ rect_data.Position(1) + rect_data.Position(3) ...
+ rect_data.Position(1)];
+
+ %---------------------------------------------------------------------%
+
+ %-rectangle y-%
+ obj.data{rectIndex}.y = [rect_data.Position(2) rect_data.Position(2) + rect_data.Position(4) ...
+ rect_data.Position(2) + rect_data.Position(4) ...
+ rect_data.Position(2) ...
+ rect_data.Position(2)];
+
+ %---------------------------------------------------------------------%
+
+ obj.data{rectIndex}.name = rect_data.DisplayName;
+ obj.data{rectIndex}.mode = 'lines';
+ obj.data{rectIndex}.visible = strcmp(rect_data.Visible,'on');
+ obj.data{rectIndex}.fill = 'tonexty';
+ obj.data{rectIndex}.line = extractPatchLine(rect_data);
+ fill = extractPatchFace(rect_data);
+ obj.data{rectIndex}.fillcolor = fill.color;
+
+ %---------------------------------------------------------------------%
+
+ %-rectangle showlegend-%
+ leg = rect_data.Annotation;
+ legInfo = leg.LegendInformation;
+
+ switch legInfo.IconDisplayStyle
+ case 'on'
+ showleg = true;
+ case 'off'
+ showleg = false;
+ end
+
+ obj.data{rectIndex}.showlegend = showleg;
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateScatterPolar.m b/plotly/plotlyfig_aux/handlegraphics/updateScatterPolar.m
index bb139b24..f6959650 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateScatterPolar.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateScatterPolar.m
@@ -1,5 +1,4 @@
function updateScatterPolar(obj, plotIndex)
-
%-AXIS INDEX-%
axIndex = obj.getAxisIndex(obj.State.Plot(plotIndex).AssociatedAxis);
@@ -12,7 +11,7 @@ function updateScatterPolar(obj, plotIndex)
%-ASSOCIATE POLAR-AXES LAYOUT-%
obj.data{plotIndex}.subplot = sprintf('polar%d', xsource+1);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-parse plot data-%
rData = plotData.RData;
@@ -21,7 +20,7 @@ function updateScatterPolar(obj, plotIndex)
thetaData(rData<0) = mod(thetaData(rData<0)+180, 360);
rData = abs(rData);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-scatterpolar trace setting-%
obj.data{plotIndex}.type = 'scatterpolar';
@@ -29,13 +28,13 @@ function updateScatterPolar(obj, plotIndex)
obj.data{plotIndex}.visible = strcmp(plotData.Visible,'on');
obj.data{plotIndex}.name = plotData.DisplayName;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set scatterpolar data-%
obj.data{plotIndex}.r = rData;
obj.data{plotIndex}.theta = thetaData;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-trace settings-%
markerStruct = extractScatterMarker(plotData);
@@ -50,7 +49,7 @@ function updateScatterPolar(obj, plotIndex)
obj.data{plotIndex}.marker.line.color = markerStruct.line.color{1};
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-legend setting-%
leg = plotData.Annotation;
@@ -63,12 +62,10 @@ function updateScatterPolar(obj, plotIndex)
obj.data{plotIndex}.showlegend = false;
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set polar axes-%
updatePolaraxes(obj, plotIndex);
-
- %-------------------------------------------------------------------------%
end
%-------------------------------------------------------------------------%
@@ -79,7 +76,7 @@ function updateScatterPolar(obj, plotIndex)
function updatePolaraxes(obj, plotIndex)
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-AXIS INDEX-%
axIndex = obj.getAxisIndex(obj.State.Plot(plotIndex).AssociatedAxis);
@@ -93,7 +90,7 @@ function updatePolaraxes(obj, plotIndex)
thetaAxis = axisData.ThetaAxis;
rAxis = axisData.RAxis;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set domain plot-%
xo = axisData.Position(1);
@@ -104,7 +101,7 @@ function updatePolaraxes(obj, plotIndex)
polarAxis.domain.x = min([xo xo + w], 1);
polarAxis.domain.y = min([yo yo + h], 1);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-setting angular axis-%
gridColor = sprintf('rgba(%f,%f,%f,%f)', 255*axisData.GridColor, ...
@@ -126,7 +123,7 @@ function updatePolaraxes(obj, plotIndex)
polarAxis.angularaxis.gridcolor = gridColor;
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set angular axis label-%
thetaLabel = thetaAxis.Label;
@@ -138,7 +135,7 @@ function updatePolaraxes(obj, plotIndex)
polarAxis.radialaxis.title.font.color = sprintf('rgb(%f,%f,%f)', ...
255*thetaLabel.Color);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-setting radial axis-%
rLim = rAxis.Limits;
@@ -159,7 +156,7 @@ function updatePolaraxes(obj, plotIndex)
polarAxis.radialaxis.gridcolor = gridColor;
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set radial axis label-%
rLabel = thetaAxis.Label;
@@ -171,7 +168,7 @@ function updatePolaraxes(obj, plotIndex)
polarAxis.angularaxis.title.font.color = sprintf('rgb(%f,%f,%f)', ...
255*rLabel.Color);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-angular tick labels settings-%
tickValues = axisData.ThetaTick;
@@ -217,7 +214,7 @@ function updatePolaraxes(obj, plotIndex)
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-radial tick labels settings-%
tickValues = axisData.RTick;
@@ -253,13 +250,8 @@ function updatePolaraxes(obj, plotIndex)
255*rAxis.Color);
end
-
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set polaraxes to layout-%
obj.layout = setfield(obj.layout, sprintf('polar%d', xsource+1), polarAxis);
-
- %-------------------------------------------------------------------------%
end
-
-
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateScattergroup.m b/plotly/plotlyfig_aux/handlegraphics/updateScattergroup.m
index 3dcd0f2f..25d891db 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateScattergroup.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateScattergroup.m
@@ -1,228 +1,202 @@
function updateScattergroup(obj,scatterIndex)
+ %check: http://undocumentedmatlab.com/blog/undocumented-scatter-plot-behavior
+
+ %----SCATTER FIELDS----%
+
+ % x - [DONE]
+ % y - [DONE]
+ % r - [HANDLED BY SCATTER]
+ % t - [HANDLED BY SCATTER]
+ % mode - [DONE]
+ % name - [DONE]
+ % text - [NOT SUPPORTED IN MATLAB]
+ % error_y - [HANDLED BY ERRORBAR]
+ % error_x - [NOT SUPPORTED IN MATLAB]
+ % textfont - [NOT SUPPORTED IN MATLAB]
+ % textposition - [NOT SUPPORTED IN MATLAB]
+ % xaxis [DONE]
+ % yaxis [DONE]
+ % showlegend [DONE]
+ % stream - [HANDLED BY PLOTLYSTREAM]
+ % visible [DONE]
+ % type [DONE]
+ % opacity ---[TODO]
+
+ % MARKER
+ % marler.color - [DONE]
+ % marker.size - [DONE]
+ % marker.opacity - [NOT SUPPORTED IN MATLAB]
+ % marker.colorscale - [NOT SUPPORTED IN MATLAB]
+ % marker.sizemode - [DONE]
+ % marker.sizeref - [DONE]
+ % marker.maxdisplayed - [NOT SUPPORTED IN MATLAB]
+
+ % MARKER LINE
+ % marker.line.color - [DONE]
+ % marker.line.width - [DONE]
+ % marker.line.dash - [NOT SUPPORTED IN MATLAB]
+ % marker.line.opacity - [DONE]
+ % marker.line.smoothing - [NOT SUPPORTED IN MATLAB]
+ % marker.line.shape - [NOT SUPPORTED IN MATLAB]
+
+ % LINE
+ % line.color - [NA]
+ % line.width - [NA]
+ % line.dash - [NA]
+ % line.opacity [NA]
+ % line.smoothing - [NOT SUPPORTED IN MATLAB]
+ % line.shape - [NOT SUPPORTED IN MATLAB]
+ % connectgaps - [NOT SUPPORTED IN MATLAB]
+ % fill - [HANDLED BY AREA]
+ % fillcolor - [HANDLED BY AREA]
+
+ %-AXIS INDEX-%
+ axIndex = obj.getAxisIndex(obj.State.Plot(scatterIndex).AssociatedAxis);
+
+ %-SCATTER DATA STRUCTURE- %
+ scatter_data = obj.State.Plot(scatterIndex).Handle;
+
+ %-SCATTER CHILDREN-%
+ scatter_child = obj.State.Plot(scatterIndex).Handle.Children;
+
+ %-SCATTER CHILDREN DATA-%
+ scatter_child_data = scatter_child;
+
+ %-CHECK FOR MULTIPLE AXES-%
+ [xsource, ysource] = findSourceAxis(obj,axIndex);
+
+ %-AXIS DATA-%
+ xaxis = obj.layout.("xaxis" + xsource);
+ yaxis = obj.layout.("yaxis" + ysource);
-%check: http://undocumentedmatlab.com/blog/undocumented-scatter-plot-behavior
-
-%----SCATTER FIELDS----%
-
-% x - [DONE]
-% y - [DONE]
-% r - [HANDLED BY SCATTER]
-% t - [HANDLED BY SCATTER]
-% mode - [DONE]
-% name - [DONE]
-% text - [NOT SUPPORTED IN MATLAB]
-% error_y - [HANDLED BY ERRORBAR]
-% error_x - [NOT SUPPORTED IN MATLAB]
-% textfont - [NOT SUPPORTED IN MATLAB]
-% textposition - [NOT SUPPORTED IN MATLAB]
-% xaxis [DONE]
-% yaxis [DONE]
-% showlegend [DONE]
-% stream - [HANDLED BY PLOTLYSTREAM]
-% visible [DONE]
-% type [DONE]
-% opacity ---[TODO]
-
-% MARKER
-% marler.color - [DONE]
-% marker.size - [DONE]
-% marker.opacity - [NOT SUPPORTED IN MATLAB]
-% marker.colorscale - [NOT SUPPORTED IN MATLAB]
-% marker.sizemode - [DONE]
-% marker.sizeref - [DONE]
-% marker.maxdisplayed - [NOT SUPPORTED IN MATLAB]
-
-% MARKER LINE
-% marker.line.color - [DONE]
-% marker.line.width - [DONE]
-% marker.line.dash - [NOT SUPPORTED IN MATLAB]
-% marker.line.opacity - [DONE]
-% marker.line.smoothing - [NOT SUPPORTED IN MATLAB]
-% marker.line.shape - [NOT SUPPORTED IN MATLAB]
-
-% LINE
-% line.color - [NA]
-% line.width - [NA]
-% line.dash - [NA]
-% line.opacity [NA]
-% line.smoothing - [NOT SUPPORTED IN MATLAB]
-% line.shape - [NOT SUPPORTED IN MATLAB]
-% connectgaps - [NOT SUPPORTED IN MATLAB]
-% fill - [HANDLED BY AREA]
-% fillcolor - [HANDLED BY AREA]
-
-%-AXIS INDEX-%
-axIndex = obj.getAxisIndex(obj.State.Plot(scatterIndex).AssociatedAxis);
-
-%-SCATTER DATA STRUCTURE- %
-scatter_data = obj.State.Plot(scatterIndex).Handle;
-
-%-SCATTER CHILDREN-%
-scatter_child = obj.State.Plot(scatterIndex).Handle.Children;
-
-%-SCATTER CHILDREN DATA-%
-scatter_child_data = scatter_child;
-
-%-CHECK FOR MULTIPLE AXES-%
-[xsource, ysource] = findSourceAxis(obj,axIndex);
-
-%-AXIS DATA-%
-xaxis = obj.layout.("xaxis" + xsource);
-yaxis = obj.layout.("yaxis" + ysource);
-
-%-------------------------------------------------------------------------%
-
-%-scatter xaxis-%
-obj.data{scatterIndex}.xaxis = ['x' num2str(xsource)];
-
-%-------------------------------------------------------------------------%
-
-%-scatter yaxis-%
-obj.data{scatterIndex}.yaxis = ['y' num2str(ysource)];
-
-%-------------------------------------------------------------------------%
-
-%-scatter type-%
-if any(nonzeros(scatter_data.ZData))
- obj.data{scatterIndex}.type = 'scatter3d';
-else
- obj.data{scatterIndex}.type = 'scatter';
-end
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-scatter xaxis and yaxis-%
+ obj.data{scatterIndex}.xaxis = ['x' num2str(xsource)];
+ obj.data{scatterIndex}.yaxis = ['y' num2str(ysource)];
-%-scatter mode-%
-obj.data{scatterIndex}.mode = 'markers';
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-scatter type-%
+ if any(nonzeros(scatter_data.ZData))
+ obj.data{scatterIndex}.type = 'scatter3d';
+ else
+ obj.data{scatterIndex}.type = 'scatter';
+ end
-%-scatter visible-%
-obj.data{scatterIndex}.visible = strcmp(scatter_data.Visible,'on');
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ obj.data{scatterIndex}.mode = 'markers';
+ obj.data{scatterIndex}.visible = strcmp(scatter_data.Visible,'on');
+ obj.data{scatterIndex}.name = scatter_data.DisplayName;
-%-scatter name-%
-obj.data{scatterIndex}.name = scatter_data.DisplayName;
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-scatter patch data-%
+ for m = 1:length(scatter_child_data)
-%-scatter patch data-%
-for m = 1:length(scatter_child_data)
-
- %reverse counter
- n = length(scatter_child_data) - m + 1;
-
- %---------------------------------------------------------------------%
-
- %-scatter x-%
- if length(scatter_child_data) > 1
- obj.data{scatterIndex}.x(m) = scatter_child_data(n).XData;
- else
- obj.data{scatterIndex}.x = scatter_child_data.XData;
- end
-
- %---------------------------------------------------------------------%
-
- %-scatter y-%
- if length(scatter_child_data) > 1
- obj.data{scatterIndex}.y(m) = scatter_child_data(n).YData;
- else
- obj.data{scatterIndex}.y = scatter_child_data.YData;
- end
-
- %---------------------------------------------------------------------%
-
- %-scatter z-%
- if any(nonzeros(scatter_data.ZData))
+ %reverse counter
+ n = length(scatter_child_data) - m + 1;
+
+ %-----------------------------------------------------------------%
+
+ %-scatter x-%
if length(scatter_child_data) > 1
- obj.data{scatterIndex}.z(m) = scatter_child_data(n).ZData;
+ obj.data{scatterIndex}.x(m) = scatter_child_data(n).XData;
else
- obj.data{scatterIndex}.z = scatter_child_data.ZData;
+ obj.data{scatterIndex}.x = scatter_child_data.XData;
end
- end
-
- %---------------------------------------------------------------------%
-
- %-scatter showlegend-%
- leg = scatter_data.Annotation;
- legInfo = leg.LegendInformation;
-
- switch legInfo.IconDisplayStyle
- case 'on'
- showleg = true;
- case 'off'
- showleg = false;
- end
-
- obj.data{scatterIndex}.showlegend = showleg;
-
- %---------------------------------------------------------------------%
-
- %-scatter marker-%
- childmarker = extractPatchMarker(scatter_child_data(n));
-
- %---------------------------------------------------------------------%
-
- %-line color-%
- if length(scatter_child_data) > 1
- if iscell(childmarker.line.color)
- obj.data{scatterIndex}.marker.line.color{m} = childmarker.line.color{1};
+
+ %-----------------------------------------------------------------%
+
+ %-scatter y-%
+ if length(scatter_child_data) > 1
+ obj.data{scatterIndex}.y(m) = scatter_child_data(n).YData;
else
- obj.data{scatterIndex}.marker.line.color{m} = childmarker.line.color;
+ obj.data{scatterIndex}.y = scatter_child_data.YData;
end
- else
- obj.data{scatterIndex}.marker.line.color = childmarker.line.color;
- end
-
- %---------------------------------------------------------------------%
-
- %-marker color-%
- if length(scatter_child_data) > 1
- if iscell(childmarker.color)
- obj.data{scatterIndex}.marker.color{m} = childmarker.color{1};
+
+ %-----------------------------------------------------------------%
+
+ %-scatter z-%
+ if any(nonzeros(scatter_data.ZData))
+ if length(scatter_child_data) > 1
+ obj.data{scatterIndex}.z(m) = scatter_child_data(n).ZData;
+ else
+ obj.data{scatterIndex}.z = scatter_child_data.ZData;
+ end
+ end
+
+ %-----------------------------------------------------------------%
+
+ %-scatter showlegend-%
+ leg = scatter_data.Annotation;
+ legInfo = leg.LegendInformation;
+
+ switch legInfo.IconDisplayStyle
+ case 'on'
+ showleg = true;
+ case 'off'
+ showleg = false;
+ end
+
+ obj.data{scatterIndex}.showlegend = showleg;
+
+ %-----------------------------------------------------------------%
+
+ %-scatter marker-%
+ childmarker = extractPatchMarker(scatter_child_data(n));
+
+ %-----------------------------------------------------------------%
+
+ %-line color-%
+ if length(scatter_child_data) > 1
+ if iscell(childmarker.line.color)
+ obj.data{scatterIndex}.marker.line.color{m} = childmarker.line.color{1};
+ else
+ obj.data{scatterIndex}.marker.line.color{m} = childmarker.line.color;
+ end
else
- obj.data{scatterIndex}.marker.color{m} = childmarker.color;
+ obj.data{scatterIndex}.marker.line.color = childmarker.line.color;
+ end
+
+ %-----------------------------------------------------------------%
+
+ %-marker color-%
+ if length(scatter_child_data) > 1
+ if iscell(childmarker.color)
+ obj.data{scatterIndex}.marker.color{m} = childmarker.color{1};
+ else
+ obj.data{scatterIndex}.marker.color{m} = childmarker.color;
+ end
+ else
+ obj.data{scatterIndex}.marker.color = childmarker.color;
+ end
+
+ %-----------------------------------------------------------------%
+
+ obj.data{scatterIndex}.marker.sizeref = childmarker.sizeref;
+ obj.data{scatterIndex}.marker.sizemode = childmarker.sizemode;
+ obj.data{scatterIndex}.marker.symbol{m} = childmarker.symbol;
+
+ %-----------------------------------------------------------------%
+
+ %-size-%
+ if length(scatter_child_data) > 1 || ischar(childmarker.color)
+ obj.data{scatterIndex}.marker.size(m) = childmarker.size;
+ else
+ obj.data{scatterIndex}.marker.size(1:length(childmarker.color)) = childmarker.size;
+ end
+
+ %-----------------------------------------------------------------%
+
+ %-line width-%
+
+ if length(scatter_child_data) > 1 || ischar(childmarker.line.color)
+ obj.data{scatterIndex}.marker.line.width(m) = childmarker.line.width;
+ else
+ obj.data{scatterIndex}.marker.line.width(1:length(childmarker.line.color)) = childmarker.line.width;
end
- else
- obj.data{scatterIndex}.marker.color = childmarker.color;
- end
-
- %---------------------------------------------------------------------%
-
- %-sizeref-%
- obj.data{scatterIndex}.marker.sizeref = childmarker.sizeref;
-
- %---------------------------------------------------------------------%
-
- %-sizemode-%
- obj.data{scatterIndex}.marker.sizemode = childmarker.sizemode;
-
- %---------------------------------------------------------------------%
-
- %-symbol-%
- obj.data{scatterIndex}.marker.symbol{m} = childmarker.symbol;
-
- %---------------------------------------------------------------------%
-
- %-size-%
- if length(scatter_child_data) > 1 || ischar(childmarker.color)
- obj.data{scatterIndex}.marker.size(m) = childmarker.size;
- else
- obj.data{scatterIndex}.marker.size(1:length(childmarker.color)) = childmarker.size;
- end
-
- %---------------------------------------------------------------------%
-
- %-line width-%
-
- if length(scatter_child_data) > 1 || ischar(childmarker.line.color)
- obj.data{scatterIndex}.marker.line.width(m) = childmarker.line.width;
- else
- obj.data{scatterIndex}.marker.line.width(1:length(childmarker.line.color)) = childmarker.line.width;
end
-
- %---------------------------------------------------------------------%
-
-end
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateScatterhistogram.m b/plotly/plotlyfig_aux/handlegraphics/updateScatterhistogram.m
index 8d4717ce..ee205067 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateScatterhistogram.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateScatterhistogram.m
@@ -1,7 +1,4 @@
function updateScatterhistogram(obj, plotIndex)
-
- %-------------------------------------------------------------------------%
-
%-INITIALIZATIONS-%
axIndex = obj.getAxisIndex(obj.State.Plot(plotIndex).AssociatedAxis);
@@ -10,7 +7,7 @@ function updateScatterhistogram(obj, plotIndex)
[~, ~, groupName] = getTraceData(plotData);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-SET MAIN SCATTER PLOT-%
@@ -24,7 +21,7 @@ function updateScatterhistogram(obj, plotIndex)
%-set plotly data-%
updateMainScatter(obj, plotIndex);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-SET MARGINAL PLOTS-%
@@ -41,16 +38,9 @@ function updateScatterhistogram(obj, plotIndex)
updateMarginalSmooth(obj, plotIndex, 'X');
updateMarginalSmooth(obj, plotIndex, 'Y');
end
-
- %-------------------------------------------------------------------------%
end
-
-
function updateMainScatter(obj, plotIndex)
-
- %-------------------------------------------------------------------------%
-
%-INITIALIZATIONS-%
axIndex = obj.getAxisIndex(obj.State.Plot(plotIndex).AssociatedAxis);
@@ -61,20 +51,20 @@ function updateMainScatter(obj, plotIndex)
traceIndex = plotIndex;
[xData, yData, groupName] = getTraceData(plotData);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-SET EACH ALL TRACES-%
for t = 1:length(xData)
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-get current trace index-%
if t > 1
obj.PlotOptions.nPlots = obj.PlotOptions.nPlots + 1;
traceIndex = obj.PlotOptions.nPlots;
end
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-set current trace-%
obj.data{traceIndex}.type = 'scatter';
@@ -83,13 +73,13 @@ function updateMainScatter(obj, plotIndex)
obj.data{traceIndex}.yaxis = sprintf('y%d', ySource);
obj.data{traceIndex}.visible = strcmp(plotData.Visible,'on');
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-set current trace data-%
obj.data{traceIndex}.x = xData{t};
obj.data{traceIndex}.y = yData{t};
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-scatter marker-%
childmarker = extractScatterhistogramMarker(plotData, t);
@@ -107,25 +97,16 @@ function updateMainScatter(obj, plotIndex)
obj.data{traceIndex}.legendgroup = obj.data{traceIndex}.name;
obj.data{traceIndex}.showlegend = true;
end
-
- %---------------------------------------------------------------------%
end
-
- %-------------------------------------------------------------------------%
end
function updateMainScatterAxis(obj, plotIndex)
-
- %-------------------------------------------------------------------------%
-
%-INITIALIZATIONS-%
axIndex = obj.getAxisIndex(obj.State.Plot(plotIndex).AssociatedAxis);
plotData = obj.State.Plot(plotIndex).Handle;
[xSource, ySource] = findSourceAxis(obj,axIndex);
- %-------------------------------------------------------------------------%
-
%-set x axis-%
xaxis = getMainScatterAxis(plotData, 'X');
xaxis.anchor = sprintf('y%d', xSource);
@@ -135,12 +116,9 @@ function updateMainScatterAxis(obj, plotIndex)
yaxis = getMainScatterAxis(plotData, 'Y');
yaxis.anchor = sprintf('x%d', ySource);
obj.layout = setfield(obj.layout, sprintf('yaxis%d',xSource), yaxis);
-
- %-------------------------------------------------------------------------%
end
function ax = getMainScatterAxis(plotData, axName)
-
axisPos = plotData.Position;
axisColor = 'rgba(0,0,0, 0.9)';
axisLim = plotData.(axName + "Limits");
@@ -188,9 +166,6 @@ function updateMainScatterAxis(obj, plotIndex)
end
function updateMarginalHistogram(obj, plotIndex, axName)
-
- %-------------------------------------------------------------------------%
-
%-INITIALIZATIONS-%
axIndex = obj.getAxisIndex(obj.State.Plot(plotIndex).AssociatedAxis);
plotData = obj.State.Plot(plotIndex).Handle;
@@ -200,32 +175,29 @@ function updateMarginalHistogram(obj, plotIndex, axName)
%-get trace data-%
[xData, yData, groupName] = getTraceData(plotData);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-SET ALL TRACES-%
for t = 1:length(xData)
-
- %---------------------------------------------------------------------%
-
%-get current trace index-%
obj.PlotOptions.nPlots = obj.PlotOptions.nPlots + 1;
traceIndex = obj.PlotOptions.nPlots;
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-set current trace-%
obj.data{traceIndex}.type = 'histogram';
obj.data{traceIndex}.xaxis = sprintf('x%d', xySource);
obj.data{traceIndex}.yaxis = sprintf('y%d', xySource);
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-set current plot data-%
obj.data{traceIndex}.x = xData{t};
obj.data{traceIndex}.y = yData{t};
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-set other trace properties-%
traceColor = getStringColor(plotData.Color(t,:), 0.7);
@@ -244,7 +216,7 @@ function updateMarginalHistogram(obj, plotIndex, axName)
try obj.data{traceIndex}.nbinsy = plotData.NumBins(2,t); end
end
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-link legend-%
if ~isempty(groupName)
@@ -256,17 +228,10 @@ function updateMarginalHistogram(obj, plotIndex, axName)
obj.data{traceIndex}.legendgroup = obj.data{traceIndex}.name;
end
-
- %---------------------------------------------------------------------%
end
-
- %-------------------------------------------------------------------------%
end
function updateMarginalSmooth(obj, plotIndex, axName)
-
- %-------------------------------------------------------------------------%
-
%-INITIALIZATIONS-%
axIndex = obj.getAxisIndex(obj.State.Plot(plotIndex).AssociatedAxis);
plotData = obj.State.Plot(plotIndex).Handle;
@@ -278,19 +243,19 @@ function updateMarginalSmooth(obj, plotIndex, axName)
axisLim = getAxisLim(plotData, axName);
evalPoints = linspace(axisLim(1), axisLim(2), 500);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-SET ALL TRACES-%
for t = 1:length(xData)
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-get current trace index-%
obj.PlotOptions.nPlots = obj.PlotOptions.nPlots + 1;
traceIndex = obj.PlotOptions.nPlots;
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-set current trace-%
obj.data{traceIndex}.type = 'scatter';
@@ -298,7 +263,7 @@ function updateMarginalSmooth(obj, plotIndex, axName)
obj.data{traceIndex}.xaxis = sprintf('x%d', xySource);
obj.data{traceIndex}.yaxis = sprintf('y%d', xySource);
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-get current trace data-%
if strcmp(axName, 'X')
@@ -311,7 +276,7 @@ function updateMarginalSmooth(obj, plotIndex, axName)
obj.data{traceIndex}.x = xSmooth;
obj.data{traceIndex}.y = ySmooth;
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-set other trace properties-%
traceColor = getStringColor(plotData.Color(t,:), 0.7);
@@ -322,7 +287,7 @@ function updateMarginalSmooth(obj, plotIndex, axName)
obj.data{traceIndex}.line.dash = getLineDash(lineStyle);
obj.data{traceIndex}.showlegend = false;
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-link legend-%
if ~isempty(groupName)
@@ -334,18 +299,10 @@ function updateMarginalSmooth(obj, plotIndex, axName)
obj.data{traceIndex}.legendgroup = obj.data{traceIndex}.name;
end
-
- %---------------------------------------------------------------------%
end
-
- %-------------------------------------------------------------------------%
end
-
-
function updateXMarginalAxis(obj, plotIndex)
- %-------------------------------------------------------------------------%
-
%-INITIALIZATIONS-%
axIndex = obj.getAxisIndex(obj.State.Plot(plotIndex).AssociatedAxis);
@@ -354,7 +311,7 @@ function updateXMarginalAxis(obj, plotIndex)
xySource = obj.State.Figure.NumAxes + 1;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set x axis-%
xaxis = getXMarginalAxis(plotData, 'X');
@@ -365,12 +322,9 @@ function updateXMarginalAxis(obj, plotIndex)
yaxis = getXMarginalAxis(plotData, 'Y');
yaxis.anchor = sprintf('x%d', xySource);
obj.layout = setfield(obj.layout, sprintf('yaxis%d',xySource), yaxis);
-
- %-------------------------------------------------------------------------%
end
function ax = getXMarginalAxis(plotData, axName)
-
switch axName
case 'X'
ax.showline = true;
@@ -401,7 +355,6 @@ function updateXMarginalAxis(obj, plotIndex)
elseif ~isempty(strfind(plotLocation, 'North'))
yo = 0.02; h = axisPos(2)*0.7-yo;
end
-
axisDomain = min([yo yo+h], 1);
end
end
@@ -409,8 +362,6 @@ function updateXMarginalAxis(obj, plotIndex)
function updateYMarginalAxis(obj, plotIndex)
- %-------------------------------------------------------------------------%
-
%-INITIALIZATIONS-%
axIndex = obj.getAxisIndex(obj.State.Plot(plotIndex).AssociatedAxis);
@@ -419,8 +370,6 @@ function updateYMarginalAxis(obj, plotIndex)
xySource = obj.State.Figure.NumAxes + 2;
- %-------------------------------------------------------------------------%
-
%-set x axis-%
xaxis = getYMarginalAxis(plotData, 'X');
xaxis.anchor = sprintf('y%d', xySource);
@@ -430,12 +379,9 @@ function updateYMarginalAxis(obj, plotIndex)
yaxis = getYMarginalAxis(plotData, 'Y');
yaxis.anchor = sprintf('x%d', xySource);
obj.layout = setfield(obj.layout, sprintf('yaxis%d',xySource), yaxis);
-
- %-------------------------------------------------------------------------%
end
function ax = getYMarginalAxis(plotData, axName)
-
switch axName
case 'X'
ax.showline = false;
@@ -444,7 +390,6 @@ function updateYMarginalAxis(obj, plotIndex)
ax.linecolor = 'black';
ax.range = getAxisLim(plotData, 'Y');
end
-
ax.domain = getYMarginalDomain(plotData, axName);
ax.showgrid = false;
ax.showticklabels = false;
@@ -454,7 +399,6 @@ function updateYMarginalAxis(obj, plotIndex)
function axisDomain = getYMarginalDomain(plotData, axName)
axisPos = plotData.Position;
plotLocation = plotData.ScatterPlotLocation;
-
switch axName
case 'X'
if ~isempty(strfind(plotLocation, 'West'))
@@ -463,18 +407,12 @@ function updateYMarginalAxis(obj, plotIndex)
elseif ~isempty(strfind(plotLocation, 'East'))
xo = 0.02; w = axisPos(1)*0.7-xo;
end
-
axisDomain = min([xo xo+w], 1);
-
case 'Y'
-
axisDomain = min([axisPos(2) sum(axisPos([2,4]))], 1);
-
end
end
-
-
function lineDash = getLineDash(lineStyle)
switch lineStyle
case '-'
@@ -491,7 +429,6 @@ function updateYMarginalAxis(obj, plotIndex)
function axisLim = getAxisLim(plotData, axName)
axisLim = plotData.(axName + "Limits");
axisPlot = plotData.(axName + "Data");
-
if iscategorical(axisPlot)
axisPlot = plotData.(axName + "Data");
[~, ~, axisPlot] = unique(axisPlot);
@@ -515,13 +452,11 @@ function updateYMarginalAxis(obj, plotIndex)
if isByGroups
if iscellstr(groupData), groupData = string(groupData); end
groupName = unique(groupData,'stable');
-
for g = 1:length(groupName)
groudInd = groupData == groupName(g);
xData{g} = xPlot(groudInd);
yData{g} = yPlot(groudInd);
end
-
if isnumeric(groupName), groupName=num2str(groupName); end;
else
xData{1} = xPlot;
@@ -598,4 +533,3 @@ function updateLegend(obj, plotIndex, groupName)
end
end
end
-
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateSlice.m b/plotly/plotlyfig_aux/handlegraphics/updateSlice.m
index bb6d37e8..402a2784 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateSlice.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateSlice.m
@@ -1,7 +1,4 @@
function obj = updateSlice(obj, dataIndex)
-
- %-------------------------------------------------------------------------%
-
%-INITIALIZATIONS-%
axIndex = obj.getAxisIndex(obj.State.Plot(dataIndex).AssociatedAxis);
@@ -43,7 +40,7 @@
end
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set trace-%
obj.data{dataIndex}.type = 'surface';
@@ -53,14 +50,14 @@
obj.data{dataIndex}.showscale = false;
obj.data{dataIndex}.surfacecolor = cDataSurf;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set trace data-%
obj.data{dataIndex}.x = xDataSurf;
obj.data{dataIndex}.y = yDataSurf;
obj.data{dataIndex}.z = zDataSurf;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-update face color-%
updateSurfaceFaceColor(obj, dataIndex, cDataSurf);
@@ -69,14 +66,9 @@
if isnumeric(plotData.EdgeColor)
updateSurfaceEdgeColor(obj, dataIndex);
end
-
- %-------------------------------------------------------------------------%
end
function updateScene(obj, dataIndex)
-
- %-------------------------------------------------------------------------%
-
%-INITIALIZATIONS-%
axIndex = obj.getAxisIndex(obj.State.Plot(dataIndex).AssociatedAxis);
plotData = obj.State.Plot(dataIndex).Handle;
@@ -91,7 +83,7 @@ function updateScene(obj, dataIndex)
cameraEye = cameraPosition./dataAspectRatio;
normFac = 0.625*abs(min(cameraEye));
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-aspect ratio-%
scene.aspectratio.x = 1.15*aspectRatio(1);
@@ -111,7 +103,7 @@ function updateScene(obj, dataIndex)
%-camera projection-%
% scene.camera.projection.type = axisData.Projection;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-scene axis configuration-%
scene.xaxis.range = axisData.XLim;
@@ -157,18 +149,13 @@ function updateScene(obj, dataIndex)
if strcmp(axisData.YGrid, 'off'), scene.yaxis.showgrid = false; end
if strcmp(axisData.ZGrid, 'off'), scene.zaxis.showgrid = false; end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-SET SCENE TO LAYOUT-%
obj.layout = setfield(obj.layout, sprintf('scene%d', xSource), scene);
-
- %-------------------------------------------------------------------------%
end
function updateSurfaceEdgeColor(obj, dataIndex)
-
- %-------------------------------------------------------------------------%
-
%-INITIALIZATIONS-%
axIndex = obj.getAxisIndex(obj.State.Plot(dataIndex).AssociatedAxis);
@@ -187,7 +174,7 @@ function updateSurfaceEdgeColor(obj, dataIndex)
xConst = ( xData(:) - min(xData(:)) ) <= 1e-6;
yConst = ( yData(:) - min(yData(:)) ) <= 1e-6;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-edge lines in x direction-%
xContourSize = mean(diff(xData(1,:)));
@@ -222,7 +209,7 @@ function updateSurfaceEdgeColor(obj, dataIndex)
obj.data{dataIndex}.contours.z.size = zContourSize;
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-coloring-%
numColor = 255 * edgeColor;
@@ -231,14 +218,9 @@ function updateSurfaceEdgeColor(obj, dataIndex)
obj.data{dataIndex}.contours.x.color = stringColor;
obj.data{dataIndex}.contours.y.color = stringColor;
obj.data{dataIndex}.contours.z.color = stringColor;
-
- %-------------------------------------------------------------------------%
end
function updateSurfaceFaceColor(obj, dataIndex, surfaceColor)
-
- %-------------------------------------------------------------------------%
-
%-INITIALIZATIONS-%
axIndex = obj.getAxisIndex(obj.State.Plot(dataIndex).AssociatedAxis);
@@ -252,7 +234,7 @@ function updateSurfaceFaceColor(obj, dataIndex, surfaceColor)
obj.data{dataIndex}.cauto = false;
obj.data{dataIndex}.autocolorscale = false;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
if isnumeric(faceColor)
numColor = 255 * faceColor;
@@ -261,11 +243,9 @@ function updateSurfaceFaceColor(obj, dataIndex, surfaceColor)
colorScale{1} = {0, stringColor};
colorScale{2} = {1, stringColor};
obj.data{dataIndex}.colorscale = colorScale;
-
elseif ismember(faceColor, {'flat', 'interp'})
-
nColors = size(colorMap, 1);
-
+
for c = 1:nColors
stringColor = getStringColor(255*colorMap(c,:));
colorScale{c} = {(c-1)/(nColors-1), stringColor};
@@ -273,16 +253,12 @@ function updateSurfaceFaceColor(obj, dataIndex, surfaceColor)
obj.data{dataIndex}.cmin = cLim(1);
obj.data{dataIndex}.cmax = cLim(2);
-
end
obj.data{dataIndex}.surfacecolor = surfaceColor;
obj.data{dataIndex}.colorscale = colorScale;
-
- %-------------------------------------------------------------------------%
end
function stringColor = getStringColor(numColor)
-
stringColor = sprintf('rgb(%f,%f,%f)', numColor);
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateSpiderPlot.m b/plotly/plotlyfig_aux/handlegraphics/updateSpiderPlot.m
index 28610c7e..2e4d6b72 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateSpiderPlot.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateSpiderPlot.m
@@ -1,7 +1,4 @@
function obj = updateSpiderPlot(obj,spiderIndex)
-
- %-------------------------------------------------------------------------%
-
%-INITIALIZATIONS-%
axIndex = obj.getAxisIndex(obj.State.Plot(spiderIndex).AssociatedAxis);
plotData = obj.State.Plot(spiderIndex).Handle;
@@ -19,7 +16,7 @@
setLegeng(obj, spiderIndex);
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set traces-%
for t = 1:nTraces
@@ -69,12 +66,9 @@
end
end
-
- %-------------------------------------------------------------------------%
end
function [xData, yData] = getCartesianPoints(plotData, axesStruct, traceIndex)
-
%-initializations-%
rData = plotData.P(traceIndex, :);
axesAngle = axesStruct.axesAngle;
@@ -82,7 +76,6 @@
nTicks = axesStruct.nTicks;
for a = 1:nAxes
-
%-get axis limits-%
try
axesLim = plotData.AxesLimits(:, a)';
@@ -138,7 +131,6 @@
end
function markerStruct = getMarker(plotData, traceIndex)
-
%-INITIALIZATIONS-%
markerStruct = struct();
@@ -188,9 +180,6 @@
end
function setAnnotation(obj, axesStruct, spiderIndex)
-
- %-------------------------------------------------------------------------%
-
%-INITIALIZATIONS-%
axIndex = obj.getAxisIndex(obj.State.Plot(spiderIndex).AssociatedAxis);
anIndex = obj.PlotlyDefaults.anIndex;
@@ -220,7 +209,7 @@ function setAnnotation(obj, axesStruct, spiderIndex)
axesSize = plotData.AxesFontSize;
axesFamily = matlab2plotlyfont(plotData.AxesFont);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set axes labels-%
for l = 1:nAxes
@@ -275,7 +264,7 @@ function setAnnotation(obj, axesStruct, spiderIndex)
anIndex = anIndex + 1;
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set axes tick labels-%
for t = 1:nTicks
@@ -373,28 +362,23 @@ function setAnnotation(obj, axesStruct, spiderIndex)
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set annotations to layout-%
obj.layout = setfield(obj.layout, 'annotations', annotations);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
obj.PlotlyDefaults.anIndex = anIndex;
-
- %-------------------------------------------------------------------------%
end
function axesStruct = setAxes(obj, spiderIndex)
-
- %-------------------------------------------------------------------------%
-
%-INITIALIZATIONS-%
axIndex = obj.getAxisIndex(obj.State.Plot(spiderIndex).AssociatedAxis);
plotData = obj.State.Plot(spiderIndex).Handle;
[xSource, ySource] = findSourceAxis(obj, axIndex);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set axes-%
nAxes = size(plotData.P,2);
@@ -404,7 +388,6 @@ function setAnnotation(obj, axesStruct, spiderIndex)
axesColor = sprintf('rgb(%f,%f,%f)', 255*plotData.AxesColor);
for a = 1:nAxes
-
%-get plotIndex-%
if a > 1
obj.PlotOptions.nPlots = obj.PlotOptions.nPlots + 1;
@@ -434,10 +417,9 @@ function setAnnotation(obj, axesStruct, spiderIndex)
%-hide associated trace-%
obj.data{plotIndex}.showlegend = false;
-
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set grid-%
nTicks = plotData.AxesInterval + 1;
@@ -468,21 +450,16 @@ function setAnnotation(obj, axesStruct, spiderIndex)
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-return-%
axesStruct.axesAngle = axesAngle;
axesStruct.nAxes = nAxes;
axesStruct.nTicks = nTicks;
axesStruct.tickValues = tickValues;
-
- %-------------------------------------------------------------------------%
end
function updateSpiderLayout(obj, spiderIndex)
-
- %-------------------------------------------------------------------------%
-
%-INITIALIZATIONS-%
axIndex = obj.getAxisIndex(obj.State.Plot(spiderIndex).AssociatedAxis);
plotData = obj.State.Plot(spiderIndex).Handle;
@@ -493,7 +470,7 @@ function updateSpiderLayout(obj, spiderIndex)
w = plotData.Position(3);
h = plotData.Position(4);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-get x axis-%
xaxis.domain = min([xo xo + w],1);
@@ -503,7 +480,7 @@ function updateSpiderLayout(obj, spiderIndex)
xaxis.showgrid = false;
xaxis.showticklabels = false;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-get y axis-%
yaxis.domain = min([yo yo + h],1);
@@ -513,19 +490,14 @@ function updateSpiderLayout(obj, spiderIndex)
yaxis.showgrid = false;
yaxis.showticklabels = false;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set axis-%
obj.layout = setfield(obj.layout, sprintf('xaxis%d', xSource), xaxis);
obj.layout = setfield(obj.layout, sprintf('yaxis%d', ySource), yaxis);
-
- %-------------------------------------------------------------------------%
end
function setLegeng(obj, spiderIndex)
-
- %-------------------------------------------------------------------------%
-
%-INITIALIZATIONS-%
axIndex = obj.getAxisIndex(obj.State.Plot(spiderIndex).AssociatedAxis);
plotData = obj.State.Plot(spiderIndex).Handle;
@@ -534,7 +506,7 @@ function setLegeng(obj, spiderIndex)
legData = plotData.LegendHandle;
obj.layout.showlegend = strcmpi(plotData.Visible,'on');
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-legend location-%
obj.layout.legend.x = legData.Position(1);
@@ -544,7 +516,7 @@ function setLegeng(obj, spiderIndex)
obj.layout.legend.xanchor = 'left';
obj.layout.legend.yanchor = 'top';
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-legend settings-%
if (strcmp(legData.Box,'on') && strcmp(legData.Visible, 'on'))
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateStackedplot.m b/plotly/plotlyfig_aux/handlegraphics/updateStackedplot.m
index 9157ef1b..21daec1f 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateStackedplot.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateStackedplot.m
@@ -1,7 +1,4 @@
function updateStackedplot(obj, plotIndex)
-
- %-------------------------------------------------------------------------%
-
%-INITIALIZATIONS-%
axIndex = obj.getAxisIndex(obj.State.Plot(plotIndex).AssociatedAxis);
@@ -34,12 +31,12 @@ function updateStackedplot(obj, plotIndex)
end
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-UPDATE STACKEDPLOT AXIS-%
updateStackedplotAxis(obj, plotIndex)
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-SET TRACES-%
traceIndex = plotIndex;
@@ -77,27 +74,22 @@ function updateStackedplot(obj, plotIndex)
end
end
-
- %-------------------------------------------------------------------------%
end
function updateStackedplotAxis(obj, plotIndex)
-
- %-------------------------------------------------------------------------%
-
%-INITIALIZATIONS-%
axIndex = obj.getAxisIndex(obj.State.Plot(plotIndex).AssociatedAxis);
plotData = obj.State.Plot(plotIndex).Handle;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-SET X-AXIS-%
[xaxis, xExpoFormat] = getAxis(obj, plotIndex, 'X');
obj.layout = setfield(obj.layout, 'xaxis1', xaxis{1});
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-SET Y-AXIS-%
@@ -107,7 +99,7 @@ function updateStackedplotAxis(obj, plotIndex)
obj.layout = setfield(obj.layout, sprintf('yaxis%d', a), yaxis{a});
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-SET AXES ANOTATIONS-%
@@ -124,9 +116,6 @@ function updateStackedplotAxis(obj, plotIndex)
end
function [ax, expoFormat] = getAxis(obj, plotIndex, axName)
-
- %-------------------------------------------------------------------------%
-
%-INITIALIZATIONS-%
axIndex = obj.getAxisIndex(obj.State.Plot(plotIndex).AssociatedAxis);
@@ -140,7 +129,7 @@ function updateStackedplotAxis(obj, plotIndex)
fontFamily = matlab2plotlyfont(plotData.FontName);;
tickLen = 5;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-Parse parameters accorging to axisName (X or Y)
@@ -173,7 +162,7 @@ function updateStackedplotAxis(obj, plotIndex)
end
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-GET EACH AXIS-%
@@ -232,12 +221,9 @@ function updateStackedplotAxis(obj, plotIndex)
ax{a}.titlefont.family = fontFamily;
end
end
-
- %-------------------------------------------------------------------------%
end
function [tickVals, tickText] = getDateTicks(axisLim, nTicks)
-
%-by year-%
yearLim = year(axisLim);
isYear = length(unique(yearLim)) > 1;
@@ -352,7 +338,6 @@ function updateTitle(obj, titleText, xySource)
end
function updateExponentFormat(obj, expoFormat, xySource, axName)
-
axName = lower(axName);
xaxis = obj.layout.("xaxis" + xySource(1));
yaxis = obj.layout.("yaxis" + xySource(2));
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateStairseries.m b/plotly/plotlyfig_aux/handlegraphics/updateStairseries.m
index d5ee7d75..54144dfb 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateStairseries.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateStairseries.m
@@ -1,22 +1,14 @@
function obj = updateStairseries(obj, dataIndex)
+ %-store original stair handle-%
+ stair_group = obj.State.Plot(dataIndex).Handle;
-%-store original stair handle-%
-stair_group = obj.State.Plot(dataIndex).Handle;
+ %-get children-%
+ stair_child = stair_group.Children;
-%------------------------------------------------------------------------%
-
-%-get children-%
-stair_child = stair_group.Children;
-
-%------------------------------------------------------------------------%
-
-%-update line -%
-obj.State.Plot(dataIndex).Handle = stair_child(1);
-updateLineseries(obj,dataIndex);
-
-%------------------------------------------------------------------------%
-
-%-revert handle-%
-obj.State.Plot(dataIndex).Handle = stair_group;
+ %-update line -%
+ obj.State.Plot(dataIndex).Handle = stair_child(1);
+ updateLineseries(obj,dataIndex);
+ %-revert handle-%
+ obj.State.Plot(dataIndex).Handle = stair_group;
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateStemseries.m b/plotly/plotlyfig_aux/handlegraphics/updateStemseries.m
index c2623bf5..8cd01422 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateStemseries.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateStemseries.m
@@ -1,54 +1,52 @@
function obj = updateStemseries(obj,dataIndex)
+ %-store original stem handle-%
+ stem_group = obj.State.Plot(dataIndex).Handle;
-%-store original stem handle-%
-stem_group = obj.State.Plot(dataIndex).Handle;
+ %-get children-%
+ stem_child = stem_group.Children;
-%-get children-%
-stem_child = stem_group.Children;
+ %---------------------------------------------------------------------%
-%------------------------------------------------------------------------%
+ %-update line-%
+ obj.State.Plot(dataIndex).Handle = stem_child(1);
+ updateLineseries(obj,dataIndex);
+ stem_temp_data = obj.data{dataIndex};
-%-update line-%
-obj.State.Plot(dataIndex).Handle = stem_child(1);
-updateLineseries(obj,dataIndex);
-stem_temp_data = obj.data{dataIndex};
+ %---------------------------------------------------------------------%
-%------------------------------------------------------------------------%
+ %-scatter mode-%
+ stem_temp_data.mode = 'lines+markers';
-%-scatter mode-%
-stem_temp_data.mode = 'lines+markers';
+ %---------------------------------------------------------------------%
-%------------------------------------------------------------------------%
+ %-update marker-%
+ obj.State.Plot(dataIndex).Handle = stem_child(2);
+ updateLineseries(obj,dataIndex);
-%-update marker-%
-obj.State.Plot(dataIndex).Handle = stem_child(2);
-updateLineseries(obj,dataIndex);
+ %---------------------------------------------------------------------%
-%------------------------------------------------------------------------%
+ stem_temp_data.marker = obj.data{dataIndex}.marker;
-stem_temp_data.marker = obj.data{dataIndex}.marker;
+ %-hide every other marker-%
+ color_temp = cell(1,length(stem_temp_data.x));
+ line_color_temp = cell(1,length(stem_temp_data.x));
-%-hide every other marker-%
-color_temp = cell(1,length(stem_temp_data.x));
-line_color_temp = cell(1,length(stem_temp_data.x));
+ for n = 1:3:length(stem_temp_data.x)
+ color_temp{n} = 'rgba(0,0,0,0)';
+ color_temp{n+1} = stem_temp_data.marker.color;
+ color_temp{n+2} = 'rgba(0,0,0,0)';
+ line_color_temp{n} = 'rgba(0,0,0,0)';
+ line_color_temp{n+1} = stem_temp_data.marker.line.color;
+ line_color_temp{n+2} = 'rgba(0,0,0,0)';
+ end
-for n = 1:3:length(stem_temp_data.x)
- color_temp{n} = 'rgba(0,0,0,0)';
- color_temp{n+1} = stem_temp_data.marker.color;
- color_temp{n+2} = 'rgba(0,0,0,0)';
- line_color_temp{n} = 'rgba(0,0,0,0)';
- line_color_temp{n+1} = stem_temp_data.marker.line.color;
- line_color_temp{n+2} = 'rgba(0,0,0,0)';
-end
-
-% add new marker/line colors
-stem_temp_data.marker.color = color_temp;
-stem_temp_data.marker.line.color = line_color_temp;
-
-%------------------------------------------------------------------------%
+ % add new marker/line colors
+ stem_temp_data.marker.color = color_temp;
+ stem_temp_data.marker.line.color = line_color_temp;
-%-revert handle-%
-obj.State.Plot(dataIndex).Handle = stem_group;
-obj.data{dataIndex} = stem_temp_data;
+ %---------------------------------------------------------------------%
+ %-revert handle-%
+ obj.State.Plot(dataIndex).Handle = stem_group;
+ obj.data{dataIndex} = stem_temp_data;
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateStreamtube.m b/plotly/plotlyfig_aux/handlegraphics/updateStreamtube.m
index b6023756..4453b825 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateStreamtube.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateStreamtube.m
@@ -1,226 +1,190 @@
function obj = updateStreamtube(obj, surfaceIndex)
- if strcmpi(obj.State.Plot(surfaceIndex).Class, 'surface')
- updateSurfaceStreamtube(obj, surfaceIndex)
- end
+ if strcmpi(obj.State.Plot(surfaceIndex).Class, 'surface')
+ updateSurfaceStreamtube(obj, surfaceIndex)
+ end
end
function updateSurfaceStreamtube(obj, surfaceIndex)
+ %-AXIS INDEX-%
+ axIndex = obj.getAxisIndex(obj.State.Plot(surfaceIndex).AssociatedAxis);
-%-AXIS INDEX-%
-axIndex = obj.getAxisIndex(obj.State.Plot(surfaceIndex).AssociatedAxis);
-
-%-CHECK FOR MULTIPLE AXES-%
-[xsource, ysource] = findSourceAxis(obj,axIndex);
-
-%-SURFACE DATA STRUCTURE- %
-image_data = obj.State.Plot(surfaceIndex).Handle;
-figure_data = obj.State.Figure.Handle;
-
-%-AXIS DATA-%
-xaxis = obj.layout.("xaxis" + xsource);
-yaxis = obj.layout.("yaxis" + ysource);
+ %-CHECK FOR MULTIPLE AXES-%
+ [xsource, ysource] = findSourceAxis(obj,axIndex);
-%-------------------------------------------------------------------------%
+ %-SURFACE DATA STRUCTURE- %
+ image_data = obj.State.Plot(surfaceIndex).Handle;
+ figure_data = obj.State.Figure.Handle;
-%-surface xaxis-%
-obj.data{surfaceIndex}.xaxis = ['x' num2str(xsource)];
+ %-AXIS DATA-%
+ xaxis = obj.layout.("xaxis" + xsource);
+ yaxis = obj.layout.("yaxis" + ysource);
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-surface yaxis-%
-obj.data{surfaceIndex}.yaxis = ['y' num2str(ysource)];
+ %-surface xaxis and yaxis-%
+ obj.data{surfaceIndex}.xaxis = ['x' num2str(xsource)];
+ obj.data{surfaceIndex}.yaxis = ['y' num2str(ysource)];
+
+ %---------------------------------------------------------------------%
-
-%---------------------------------------------------------------------%
+ %-surface type-%
+ obj.data{surfaceIndex}.type = 'surface';
-%-surface type-%
-obj.data{surfaceIndex}.type = 'surface';
+ %---------------------------------------------------------------------%
-%---------------------------------------------------------------------%
+ %-getting plot data-%
+ x = image_data.XData;
+ y = image_data.YData;
+ z = image_data.ZData;
+ cdata = image_data.CData;
-%-getting plot data-%
-x = image_data.XData;
-y = image_data.YData;
-z = image_data.ZData;
-cdata = image_data.CData;
-
-%-playing with level quality-%
-quality = obj.PlotOptions.Quality/100;
-apply_quality = quality > 0;
-
-if apply_quality
- x = imresize(x, quality);
- y = imresize(y, quality);
- z = imresize(z, quality);
- cdata = imresize(cdata, quality);
-end
+ %-playing with level quality-%
+ quality = obj.PlotOptions.Quality/100;
+ apply_quality = quality > 0;
-if ~isempty(obj.PlotOptions.Zmin)
- if any(z < obj.PlotOptions.Zmin)
- return;
+ if apply_quality
+ x = imresize(x, quality);
+ y = imresize(y, quality);
+ z = imresize(z, quality);
+ cdata = imresize(cdata, quality);
end
-end
-
-xymax = 100;
-xsize = size(x,2);
-ysize = size(x,1);
-
-xsize = min([xsize, xymax]);
-ysize = min([ysize, xymax]);
-x = imresize(x, [ysize, xsize]);
-y = imresize(y, [ysize, xsize]);
-z = imresize(z, [ysize, xsize]);
-cdata = imresize(cdata, [ysize, xsize]);
-
-%-optional-%
-% if isvector(x)
-% [x, y] = meshgrid(x,y);
-% end
-
-%---------------------------------------------------------------------%
-
-%-surface x-%
-obj.data{surfaceIndex}.x = x;
-
-%---------------------------------------------------------------------%
-
-%-surface y-%
-obj.data{surfaceIndex}.y = y;
-
-%---------------------------------------------------------------------%
-
-%-surface z-%
-obj.data{surfaceIndex}.z = z;
-
-%---------------------------------------------------------------------%
-
-%-if image comes would a 3D plot-%
-obj.PlotOptions.Image3D = true;
-
-%-if contour comes would a ContourProjection-%
-obj.PlotOptions.ContourProjection = true;
-
-%---------------------------------------------------------------------%
-
-%- setting grid mesh by default -%
-% x-direction
-xmin = min(x(:));
-xmax = max(x(:));
-xsize = (xmax - xmin) / (size(x, 2)-1);
-obj.data{surfaceIndex}.contours.x.start = xmin;
-obj.data{surfaceIndex}.contours.x.end = xmax;
-obj.data{surfaceIndex}.contours.x.size = xsize;
-obj.data{surfaceIndex}.contours.x.show = true;
-obj.data{surfaceIndex}.contours.x.color = 'black';
-% y-direction
-ymin = min(y(:));
-ymax = max(y(:));
-ysize = (ymax - ymin) / (size(y, 1)-1);
-obj.data{surfaceIndex}.contours.y.start = ymin;
-obj.data{surfaceIndex}.contours.y.end = ymax;
-obj.data{surfaceIndex}.contours.y.size = ysize;
-obj.data{surfaceIndex}.contours.y.show = true;
-obj.data{surfaceIndex}.contours.y.color = 'black';
-
-%------------------------------------------------------------------------%
-
-%-get data-%
-
-%-aspect ratio-%
-ar = obj.PlotOptions.AspectRatio;
-
-if ~isempty(ar)
- if ischar(ar)
- scene.aspectmode = ar;
- elseif isvector(ar) && length(ar) == 3
- xar = ar(1);
- yar = ar(2);
- zar = ar(3);
- end
- else
-
- %-define as default-%
- xar = 0.5*max(x(:));
- yar = 0.5*max(y(:));
- zar = 0.4*max([xar, yar]);
-end
-
-scene.aspectratio.x = xar;
-scene.aspectratio.y = yar;
-scene.aspectratio.z = zar;
-
-%---------------------------------------------------------------------%
-
-%-camera eye-%
-ey = obj.PlotOptions.CameraEye;
-if ~isempty(ey)
-if isvector(ey) && length(ey) == 3
- scene.camera.eye.x = ey(1);
- scene.camera.eye.y = ey(2);
- scene.camera.eye.z = ey(3);
-end
-else
-
-%-define as default-%
-fac = 0.35;
-xey = - xar; if xey>0 xfac = -fac; else xfac = fac; end
-yey = - yar; if yey>0 yfac = -fac; else yfac = fac; end
-if zar>0 zfac = fac; else zfac = -fac; end
+ if ~isempty(obj.PlotOptions.Zmin)
+ if any(z < obj.PlotOptions.Zmin)
+ return;
+ end
+ end
-scene.camera.eye.x = xey + xfac*xey;
-scene.camera.eye.y = yey + yfac*yey;
-scene.camera.eye.z = zar + zfac*zar;
-end
+ xymax = 100;
+ xsize = size(x,2);
+ ysize = size(x,1);
+
+ xsize = min([xsize, xymax]);
+ ysize = min([ysize, xymax]);
+ x = imresize(x, [ysize, xsize]);
+ y = imresize(y, [ysize, xsize]);
+ z = imresize(z, [ysize, xsize]);
+ cdata = imresize(cdata, [ysize, xsize]);
+
+ %-optional-%
+ % if isvector(x)
+ % [x, y] = meshgrid(x,y);
+ % end
+
+ %---------------------------------------------------------------------%
+
+ obj.data{surfaceIndex}.x = x;
+ obj.data{surfaceIndex}.y = y;
+ obj.data{surfaceIndex}.z = z;
+ obj.PlotOptions.Image3D = true;
+ obj.PlotOptions.ContourProjection = true;
+
+ %---------------------------------------------------------------------%
+
+ %- setting grid mesh by default -%
+ % x-direction
+ xmin = min(x(:));
+ xmax = max(x(:));
+ xsize = (xmax - xmin) / (size(x, 2)-1);
+ obj.data{surfaceIndex}.contours.x.start = xmin;
+ obj.data{surfaceIndex}.contours.x.end = xmax;
+ obj.data{surfaceIndex}.contours.x.size = xsize;
+ obj.data{surfaceIndex}.contours.x.show = true;
+ obj.data{surfaceIndex}.contours.x.color = 'black';
+ % y-direction
+ ymin = min(y(:));
+ ymax = max(y(:));
+ ysize = (ymax - ymin) / (size(y, 1)-1);
+ obj.data{surfaceIndex}.contours.y.start = ymin;
+ obj.data{surfaceIndex}.contours.y.end = ymax;
+ obj.data{surfaceIndex}.contours.y.size = ysize;
+ obj.data{surfaceIndex}.contours.y.show = true;
+ obj.data{surfaceIndex}.contours.y.color = 'black';
+
+ %---------------------------------------------------------------------%
+
+ %-get data-%
+
+ %-aspect ratio-%
+ ar = obj.PlotOptions.AspectRatio;
+
+ if ~isempty(ar)
+ if ischar(ar)
+ scene.aspectmode = ar;
+ elseif isvector(ar) && length(ar) == 3
+ xar = ar(1);
+ yar = ar(2);
+ zar = ar(3);
+ end
+ else
-obj.layout = setfield(obj.layout,['scene'], scene);
+ %-define as default-%
+ xar = 0.5*max(x(:));
+ yar = 0.5*max(y(:));
+ zar = 0.4*max([xar, yar]);
+ end
-%-------------------------------------------------------------------------%
+ scene.aspectratio.x = xar;
+ scene.aspectratio.y = yar;
+ scene.aspectratio.z = zar;
-%-image colorscale-%
+ %---------------------------------------------------------------------%
-cmap = figure_data.Colormap;
-len = length(cmap)-1;
+ %-camera eye-%
+ ey = obj.PlotOptions.CameraEye;
-for c = 1: length(cmap)
- col = 255 * cmap(c, :);
- obj.data{surfaceIndex}.colorscale{c} = { (c-1)/len , ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')' ] };
-end
-
-%-------------------------------------------------------------------------%
+ if ~isempty(ey)
+ if isvector(ey) && length(ey) == 3
+ scene.camera.eye.x = ey(1);
+ scene.camera.eye.y = ey(2);
+ scene.camera.eye.z = ey(3);
+ end
+ else
-%-surface coloring-%
-obj.data{surfaceIndex}.surfacecolor = cdata;
+ %-define as default-%
+ fac = 0.35;
+ xey = - xar; if xey>0 xfac = -fac; else xfac = fac; end
+ yey = - yar; if yey>0 yfac = -fac; else yfac = fac; end
+ if zar>0 zfac = fac; else zfac = -fac; end
-%-------------------------------------------------------------------------%
+ scene.camera.eye.x = xey + xfac*xey;
+ scene.camera.eye.y = yey + yfac*yey;
+ scene.camera.eye.z = zar + zfac*zar;
+ end
-%-surface name-%
-obj.data{surfaceIndex}.name = image_data.DisplayName;
+ obj.layout = setfield(obj.layout,['scene'], scene);
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-surface showscale-%
-obj.data{surfaceIndex}.showscale = false;
+ %-image colorscale-%
-%-------------------------------------------------------------------------%
+ cmap = figure_data.Colormap;
+ len = length(cmap)-1;
-%-surface visible-%
-obj.data{surfaceIndex}.visible = strcmp(image_data.Visible,'on');
+ for c = 1: length(cmap)
+ col = 255 * cmap(c, :);
+ obj.data{surfaceIndex}.colorscale{c} = ...
+ {(c-1)/len, sprintf("rgb(%f,%f,%f)", col)};
+ end
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-leg = image_data.Annotation;
-legInfo = leg.LegendInformation;
+ obj.data{surfaceIndex}.surfacecolor = cdata;
+ obj.data{surfaceIndex}.name = image_data.DisplayName;
+ obj.data{surfaceIndex}.showscale = false;
+ obj.data{surfaceIndex}.visible = strcmp(image_data.Visible,'on');
-switch legInfo.IconDisplayStyle
- case 'on'
- showleg = true;
- case 'off'
- showleg = false;
-end
+ %---------------------------------------------------------------------%
-obj.data{surfaceIndex}.showlegend = showleg;
+ leg = image_data.Annotation;
+ legInfo = leg.LegendInformation;
-%-------------------------------------------------------------------------%
+ switch legInfo.IconDisplayStyle
+ case 'on'
+ showleg = true;
+ case 'off'
+ showleg = false;
+ end
+ obj.data{surfaceIndex}.showlegend = showleg;
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateSurf.m b/plotly/plotlyfig_aux/handlegraphics/updateSurf.m
index ac213aa5..1ec47c3e 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateSurf.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateSurf.m
@@ -1,417 +1,404 @@
function obj = updateSurf(obj, surfaceIndex)
+ %-AXIS INDEX-%
+ axIndex = obj.getAxisIndex(obj.State.Plot(surfaceIndex).AssociatedAxis);
-%-AXIS INDEX-%
-axIndex = obj.getAxisIndex(obj.State.Plot(surfaceIndex).AssociatedAxis);
+ %-CHECK FOR MULTIPLE AXES-%
+ [xsource, ysource] = findSourceAxis(obj,axIndex);
-%-CHECK FOR MULTIPLE AXES-%
-[xsource, ysource] = findSourceAxis(obj,axIndex);
+ %-SURFACE DATA STRUCTURE- %
+ meshData = obj.State.Plot(surfaceIndex).Handle;
-%-SURFACE DATA STRUCTURE- %
-meshData = obj.State.Plot(surfaceIndex).Handle;
+ %-AXIS STRUCTURE-%
+ axisData = ancestor(meshData.Parent,'axes');
-%-AXIS STRUCTURE-%
-axisData = ancestor(meshData.Parent,'axes');
+ %-SCENE DATA-%
+ scene = obj.layout.("scene" + xsource);
-%-SCENE DATA-%
-scene = obj.layout.("scene" + xsource);
+ %-GET CONTOUR INDEX-%
+ obj.PlotOptions.nPlots = obj.PlotOptions.nPlots + 1;
+ contourIndex = obj.PlotOptions.nPlots;
+ obj.PlotOptions.contourIndex(surfaceIndex) = contourIndex;
-%-GET CONTOUR INDEX-%
-obj.PlotOptions.nPlots = obj.PlotOptions.nPlots + 1;
-contourIndex = obj.PlotOptions.nPlots;
-obj.PlotOptions.contourIndex(surfaceIndex) = contourIndex;
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-associate scene-%
+ obj.data{surfaceIndex}.scene = sprintf('scene%d', xsource);
+ obj.data{contourIndex}.scene = sprintf('scene%d', xsource);
-%-associate scene-%
-obj.data{surfaceIndex}.scene = sprintf('scene%d', xsource);
-obj.data{contourIndex}.scene = sprintf('scene%d', xsource);
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-surface type for face color-%
+ obj.data{surfaceIndex}.type = 'surface';
+
+ %-scatter3d type for contour mesh lines-%
+ obj.data{contourIndex}.type = 'scatter3d';
+ obj.data{contourIndex}.mode = 'lines';
-%-surface type for face color-%
-obj.data{surfaceIndex}.type = 'surface';
-
-%-scatter3d type for contour mesh lines-%
-obj.data{contourIndex}.type = 'scatter3d';
-obj.data{contourIndex}.mode = 'lines';
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-get plot data-%
+ xData = meshData.XData;
+ yData = meshData.YData;
+ zData = meshData.ZData;
-%-get plot data-%
-xData = meshData.XData;
-yData = meshData.YData;
-zData = meshData.ZData;
+ if isvector(xData)
+ [xData, yData] = meshgrid(xData, yData);
+ end
-if isvector(xData)
- [xData, yData] = meshgrid(xData, yData);
-end
+ %-reformat data to mesh-%
+ xDataSurface = xData;
+ yDataSurface = yData;
+ zDataSurface = zData;
-%-reformat data to mesh-%
-xDataSurface = xData;
-yDataSurface = yData;
-zDataSurface = zData;
+ xDataContourDir1 = [xDataSurface; NaN(1, size(xDataSurface, 2))];
+ yDataContourDir1 = [yDataSurface; NaN(1, size(yDataSurface, 2))];
+ zDataContourDir1 = [zDataSurface; NaN(1, size(zDataSurface, 2))];
-xDataContourDir1 = [xDataSurface; NaN(1, size(xDataSurface, 2))];
-yDataContourDir1 = [yDataSurface; NaN(1, size(yDataSurface, 2))];
-zDataContourDir1 = [zDataSurface; NaN(1, size(zDataSurface, 2))];
+ xDataContourDir2 = xDataContourDir1(1:end-1,:)';
+ yDataContourDir2 = yDataContourDir1(1:end-1,:)';
+ zDataContourDir2 = zDataContourDir1(1:end-1,:)';
-xDataContourDir2 = xDataContourDir1(1:end-1,:)';
-yDataContourDir2 = yDataContourDir1(1:end-1,:)';
-zDataContourDir2 = zDataContourDir1(1:end-1,:)';
+ xDataContourDir2 = [xDataContourDir2; NaN(1, size(xDataContourDir2, 2))];
+ yDataContourDir2 = [yDataContourDir2; NaN(1, size(yDataContourDir2, 2))];
+ zDataContourDir2 = [zDataContourDir2; NaN(1, size(zDataContourDir2, 2))];
-xDataContourDir2 = [xDataContourDir2; NaN(1, size(xDataContourDir2, 2))];
-yDataContourDir2 = [yDataContourDir2; NaN(1, size(yDataContourDir2, 2))];
-zDataContourDir2 = [zDataContourDir2; NaN(1, size(zDataContourDir2, 2))];
+ xDataContour = [xDataContourDir1(:); xDataContourDir2(:)];
+ yDataContour = [yDataContourDir1(:); yDataContourDir2(:)];
+ zDataContour = [zDataContourDir1(:); zDataContourDir2(:)];
-xDataContour = [xDataContourDir1(:); xDataContourDir2(:)];
-yDataContour = [yDataContourDir1(:); yDataContourDir2(:)];
-zDataContour = [zDataContourDir1(:); zDataContourDir2(:)];
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-set data on surface-%
+ obj.data{surfaceIndex}.x = xDataSurface;
+ obj.data{surfaceIndex}.y = yDataSurface;
+ obj.data{surfaceIndex}.z = zDataSurface;
-%-set data on surface-%
-obj.data{surfaceIndex}.x = xDataSurface;
-obj.data{surfaceIndex}.y = yDataSurface;
-obj.data{surfaceIndex}.z = zDataSurface;
+ %- setting grid mesh by default -%
+ % x-direction
+ xData = xData(1, :);
+ obj.data{surfaceIndex}.contours.x.start = xData(1);
+ obj.data{surfaceIndex}.contours.x.end = xData(end);
+ obj.data{surfaceIndex}.contours.x.size = mean(diff(xData));
+ obj.data{surfaceIndex}.contours.x.show = true;
-%- setting grid mesh by default -%
-% x-direction
-xData = xData(1, :);
-obj.data{surfaceIndex}.contours.x.start = xData(1);
-obj.data{surfaceIndex}.contours.x.end = xData(end);
-obj.data{surfaceIndex}.contours.x.size = mean(diff(xData));
-obj.data{surfaceIndex}.contours.x.show = true;
+ % y-direction
+ yData = yData(:, 1);
+ obj.data{surfaceIndex}.contours.y.start = yData(1);
+ obj.data{surfaceIndex}.contours.y.end = yData(end);
+ obj.data{surfaceIndex}.contours.y.size = mean(diff(yData));;
+ obj.data{surfaceIndex}.contours.y.show = true;
-% y-direction
-yData = yData(:, 1);
-obj.data{surfaceIndex}.contours.y.start = yData(1);
-obj.data{surfaceIndex}.contours.y.end = yData(end);
-obj.data{surfaceIndex}.contours.y.size = mean(diff(yData));;
-obj.data{surfaceIndex}.contours.y.show = true;
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-set data on scatter3d-%
+ obj.data{contourIndex}.x = xDataContour(:);
+ obj.data{contourIndex}.y = yDataContour(:);
+ obj.data{contourIndex}.z = zDataContour(:);
-%-set data on scatter3d-%
-obj.data{contourIndex}.x = xDataContour(:);
-obj.data{contourIndex}.y = yDataContour(:);
-obj.data{contourIndex}.z = zDataContour(:);
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-COLORING-%
-%-COLORING-%
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-get colormap-%
+ cMap = axisData.Colormap;
+ fac = 1/(length(cMap)-1);
+ colorScale = {};
-%-get colormap-%
-cMap = axisData.Colormap;
-fac = 1/(length(cMap)-1);
-colorScale = {};
+ for c = 1: length(cMap)
+ colorScale{c} = { (c-1)*fac , sprintf('rgb(%f,%f,%f)', 255*cMap(c, :))};
+ end
-for c = 1: length(cMap)
- colorScale{c} = { (c-1)*fac , sprintf('rgb(%f,%f,%f)', 255*cMap(c, :))};
-end
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-get edge color-%
+ if isnumeric(meshData.EdgeColor)
+ cDataContour = sprintf('rgb(%f,%f,%f)', 255*meshData.EdgeColor);
-%-get edge color-%
-if isnumeric(meshData.EdgeColor)
- cDataContour = sprintf('rgb(%f,%f,%f)', 255*meshData.EdgeColor);
+ elseif strcmpi(meshData.EdgeColor, 'interp')
+ cDataContour = zDataContour(:);
+ obj.data{contourIndex}.line.colorscale = colorScale;
-elseif strcmpi(meshData.EdgeColor, 'interp')
- cDataContour = zDataContour(:);
- obj.data{contourIndex}.line.colorscale = colorScale;
+ obj.data{surfaceIndex}.contours.x.show = false;
+ obj.data{surfaceIndex}.contours.y.show = false;
- obj.data{surfaceIndex}.contours.x.show = false;
- obj.data{surfaceIndex}.contours.y.show = false;
+ elseif strcmpi(meshData.EdgeColor, 'flat')
+ cData = meshData.CData;
-elseif strcmpi(meshData.EdgeColor, 'flat')
- cData = meshData.CData;
+ if size(cData, 3) ~= 1
+ cMap = unique( reshape(cData, ...
+ [size(cData,1)*size(cData,2), size(cData,3)]), 'rows' );
+ cData = rgb2ind(cData, cMap);
- if size(cData, 3) ~= 1
- cMap = unique( reshape(cData, ...
- [size(cData,1)*size(cData,2), size(cData,3)]), 'rows' );
- cData = rgb2ind(cData, cMap);
+ edgeColorScale = {};
+ fac = 1/(length(cMap)-1);
- edgeColorScale = {};
- fac = 1/(length(cMap)-1);
+ for c = 1: length(cMap)
+ edgeColorScale{c} = { (c-1)*fac , sprintf('rgb(%f,%f,%f)', 255*cMap(c, :))};
+ end
- for c = 1: length(cMap)
- edgeColorScale{c} = { (c-1)*fac , sprintf('rgb(%f,%f,%f)', 255*cMap(c, :))};
+ obj.data{surfaceIndex}.line.cmin = 0;
+ obj.data{surfaceIndex}.line.cmax = 255;
+ obj.data{contourIndex}.line.colorscale = edgeColorScale;
+ else
+ obj.data{contourIndex}.line.cmin = axisData.CLim(1);
+ obj.data{contourIndex}.line.cmax = axisData.CLim(2);
+ obj.data{contourIndex}.line.colorscale = colorScale;
end
- obj.data{surfaceIndex}.line.cmin = 0;
- obj.data{surfaceIndex}.line.cmax = 255;
- obj.data{contourIndex}.line.colorscale = edgeColorScale;
- else
- obj.data{contourIndex}.line.cmin = axisData.CLim(1);
- obj.data{contourIndex}.line.cmax = axisData.CLim(2);
- obj.data{contourIndex}.line.colorscale = colorScale;
- end
-
- cDataContourDir1 = [cData; NaN(1, size(cData, 2))];
- cDataContourDir2 = cDataContourDir1(1:end-1,:)';
- cDataContourDir2 = [cDataContourDir2; NaN(1, size(cDataContourDir2, 2))];
- cDataContour = [cDataContourDir1(:); cDataContourDir2(:)];
+ cDataContourDir1 = [cData; NaN(1, size(cData, 2))];
+ cDataContourDir2 = cDataContourDir1(1:end-1,:)';
+ cDataContourDir2 = [cDataContourDir2; NaN(1, size(cDataContourDir2, 2))];
+ cDataContour = [cDataContourDir1(:); cDataContourDir2(:)];
- obj.data{surfaceIndex}.contours.x.show = false;
- obj.data{surfaceIndex}.contours.y.show = false;
+ obj.data{surfaceIndex}.contours.x.show = false;
+ obj.data{surfaceIndex}.contours.y.show = false;
-elseif strcmpi(meshData.EdgeColor, 'none')
- cDataContour = 'rgba(0,0,0,0)';
- obj.data{surfaceIndex}.contours.x.show = false;
- obj.data{surfaceIndex}.contours.y.show = false;
+ elseif strcmpi(meshData.EdgeColor, 'none')
+ cDataContour = 'rgba(0,0,0,0)';
+ obj.data{surfaceIndex}.contours.x.show = false;
+ obj.data{surfaceIndex}.contours.y.show = false;
-end
+ end
-%-set edge color-%
-obj.data{contourIndex}.line.color = cDataContour;
-obj.data{surfaceIndex}.contours.x.color = cDataContour;
-obj.data{surfaceIndex}.contours.y.color = cDataContour;
+ %-set edge color-%
+ obj.data{contourIndex}.line.color = cDataContour;
+ obj.data{surfaceIndex}.contours.x.color = cDataContour;
+ obj.data{surfaceIndex}.contours.y.color = cDataContour;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-get face color-%
-faceColor = meshData.FaceColor;
+ %-get face color-%
+ faceColor = meshData.FaceColor;
-if isnumeric(faceColor)
+ if isnumeric(faceColor)
- if all(faceColor == [1, 1, 1])
- faceColor = [0.96, 0.96, 0.96];
- end
+ if all(faceColor == [1, 1, 1])
+ faceColor = [0.96, 0.96, 0.96];
+ end
- for n = 1:size(zDataSurface, 2)
- for m = 1:size(zDataSurface, 1)
- cDataSurface(m, n, :) = faceColor;
+ for n = 1:size(zDataSurface, 2)
+ for m = 1:size(zDataSurface, 1)
+ cDataSurface(m, n, :) = faceColor;
+ end
end
- end
- [cDataSurface, cMapSurface] = rgb2ind(cDataSurface, 256);
- cDataSurface = double(cDataSurface) + axisData.CLim(1);
+ [cDataSurface, cMapSurface] = rgb2ind(cDataSurface, 256);
+ cDataSurface = double(cDataSurface) + axisData.CLim(1);
- for c = 1: size(cMapSurface, 1)
- colorScale{c} = { (c-1)*fac , sprintf('rgba(%f,%f,%f, 1)', cMapSurface(c, :))};
- end
+ for c = 1: size(cMapSurface, 1)
+ colorScale{c} = { (c-1)*fac , sprintf('rgba(%f,%f,%f, 1)', cMapSurface(c, :))};
+ end
- obj.data{surfaceIndex}.cmin = axisData.CLim(1);
- obj.data{surfaceIndex}.cmax = axisData.CLim(2);
+ obj.data{surfaceIndex}.cmin = axisData.CLim(1);
+ obj.data{surfaceIndex}.cmax = axisData.CLim(2);
-elseif strcmpi(faceColor, 'interp')
- cDataSurface = zDataSurface;
+ elseif strcmpi(faceColor, 'interp')
+ cDataSurface = zDataSurface;
- if surfaceIndex > xsource
- cData = [];
+ if surfaceIndex > xsource
+ cData = [];
- for idx = xsource:surfaceIndex
- cData = [cData; obj.data{idx}.z];
- end
+ for idx = xsource:surfaceIndex
+ cData = [cData; obj.data{idx}.z];
+ end
- cMin = min(cData(:));
- cMax = max(cData(:));
+ cMin = min(cData(:));
+ cMax = max(cData(:));
- for idx = xsource:surfaceIndex
- obj.data{idx}.cmin = cMin;
- obj.data{idx}.cmax = cMax;
+ for idx = xsource:surfaceIndex
+ obj.data{idx}.cmin = cMin;
+ obj.data{idx}.cmax = cMax;
+ end
end
- end
-elseif strcmpi(faceColor, 'flat')
- cData = meshData.CData;
+ elseif strcmpi(faceColor, 'flat')
+ cData = meshData.CData;
- if size(cData, 3) ~= 1
- cMap = unique( reshape(cData, ...
- [size(cData,1)*size(cData,2), size(cData,3)]), 'rows' );
- cDataSurface = rgb2ind(cData, cMap);
+ if size(cData, 3) ~= 1
+ cMap = unique( reshape(cData, ...
+ [size(cData,1)*size(cData,2), size(cData,3)]), 'rows' );
+ cDataSurface = rgb2ind(cData, cMap);
- colorScale = {};
- fac = 1/(length(cMap)-1);
+ colorScale = {};
+ fac = 1/(length(cMap)-1);
- for c = 1: length(cMap)
- colorScale{c} = { (c-1)*fac , sprintf('rgb(%f,%f,%f)', 255*cMap(c, :))};
+ for c = 1: length(cMap)
+ colorScale{c} = { (c-1)*fac , sprintf('rgb(%f,%f,%f)', 255*cMap(c, :))};
+ end
+ else
+ cDataSurface = cData;
+ obj.data{surfaceIndex}.cmin = axisData.CLim(1);
+ obj.data{surfaceIndex}.cmax = axisData.CLim(2);
end
- else
- cDataSurface = cData;
- obj.data{surfaceIndex}.cmin = axisData.CLim(1);
- obj.data{surfaceIndex}.cmax = axisData.CLim(2);
+
end
-
-end
-%-set face color-%
-obj.data{surfaceIndex}.colorscale = colorScale;
-obj.data{surfaceIndex}.surfacecolor = cDataSurface;
+ %-set face color-%
+ obj.data{surfaceIndex}.colorscale = colorScale;
+ obj.data{surfaceIndex}.surfacecolor = cDataSurface;
-%-lighting settings-%
+ %-lighting settings-%
-if isnumeric(meshData.FaceColor) && all(meshData.FaceColor == [1, 1, 1])
- obj.data{surfaceIndex}.lighting.diffuse = 0.5;
- obj.data{surfaceIndex}.lighting.ambient = 0.725;
-else
- % obj.data{surfaceIndex}.lighting.diffuse = 1.0;
- % obj.data{surfaceIndex}.lighting.ambient = 0.9;
-end
-
-if meshData.FaceAlpha ~= 1
- obj.data{surfaceIndex}.lighting.diffuse = 0.5;
- obj.data{surfaceIndex}.lighting.ambient = 0.725 + (1-meshData.FaceAlpha);
-end
-
-if obj.PlotlyDefaults.IsLight
- obj.data{surfaceIndex}.lighting.diffuse = 1.0;
- obj.data{surfaceIndex}.lighting.ambient = 0.3;
-end
-
-%-opacity-%
-obj.data{surfaceIndex}.opacity = meshData.FaceAlpha;
-
-%-------------------------------------------------------------------------%
-
-%-line style-%
+ if isnumeric(meshData.FaceColor) && all(meshData.FaceColor == [1, 1, 1])
+ obj.data{surfaceIndex}.lighting.diffuse = 0.5;
+ obj.data{surfaceIndex}.lighting.ambient = 0.725;
+ else
+ % obj.data{surfaceIndex}.lighting.diffuse = 1.0;
+ % obj.data{surfaceIndex}.lighting.ambient = 0.9;
+ end
-obj.data{contourIndex}.line.width = 3*meshData.LineWidth;
+ if meshData.FaceAlpha ~= 1
+ obj.data{surfaceIndex}.lighting.diffuse = 0.5;
+ obj.data{surfaceIndex}.lighting.ambient = 0.725 + (1-meshData.FaceAlpha);
+ end
-if strcmpi(meshData.LineStyle, '-')
- obj.data{contourIndex}.line.dash = 'solid';
-else
- obj.data{contourIndex}.line.dash = 'dot';
- obj.data{surfaceIndex}.contours.x.show = false;
- obj.data{surfaceIndex}.contours.y.show = false;
-end
+ if obj.PlotlyDefaults.IsLight
+ obj.data{surfaceIndex}.lighting.diffuse = 1.0;
+ obj.data{surfaceIndex}.lighting.ambient = 0.3;
+ end
-%-------------------------------------------------------------------------%
+ %-opacity-%
+ obj.data{surfaceIndex}.opacity = meshData.FaceAlpha;
-%-SCENE CONFIGUTATION-%
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-line style-%
-%-aspect ratio-%
-asr = obj.PlotOptions.AspectRatio;
+ obj.data{contourIndex}.line.width = 3*meshData.LineWidth;
-if ~isempty(asr)
- if ischar(asr)
- scene.aspectmode = asr;
- elseif isvector(ar) && length(asr) == 3
- xar = asr(1);
- yar = asr(2);
- zar = asr(3);
+ if strcmpi(meshData.LineStyle, '-')
+ obj.data{contourIndex}.line.dash = 'solid';
+ else
+ obj.data{contourIndex}.line.dash = 'dot';
+ obj.data{surfaceIndex}.contours.x.show = false;
+ obj.data{surfaceIndex}.contours.y.show = false;
end
-else
- %-define as default-%
- xar = max(xData(:));
- yar = max(yData(:));
- xyar = max([xar, yar]);
- zar = 0.75*xyar;
-end
+ %---------------------------------------------------------------------%
-scene.aspectratio.x = 1.1*xyar;
-scene.aspectratio.y = 1.0*xyar;
-scene.aspectratio.z = zar;
+ %-SCENE CONFIGUTATION-%
-%---------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-camera eye-%
-ey = obj.PlotOptions.CameraEye;
+ %-aspect ratio-%
+ asr = obj.PlotOptions.AspectRatio;
-if ~isempty(ey)
- if isvector(ey) && length(ey) == 3
- scene.camera.eye.x = ey(1);
- scene.camera.eye.y = ey(2);
- scene.camera.eye.z = ey(3);
- end
-else
-
- %-define as default-%
- xey = - xyar; if xey>0 xfac = -0.0; else xfac = 0.0; end
- yey = - xyar; if yey>0 yfac = -0.3; else yfac = 0.3; end
- if zar>0 zfac = -0.1; else zfac = 0.1; end
-
- scene.camera.eye.x = xey + xfac*xey;
- scene.camera.eye.y = yey + yfac*yey;
- scene.camera.eye.z = zar + zfac*zar;
-end
+ if ~isempty(asr)
+ if ischar(asr)
+ scene.aspectmode = asr;
+ elseif isvector(ar) && length(asr) == 3
+ xar = asr(1);
+ yar = asr(2);
+ zar = asr(3);
+ end
+ else
-%-------------------------------------------------------------------------%
+ %-define as default-%
+ xar = max(xData(:));
+ yar = max(yData(:));
+ xyar = max([xar, yar]);
+ zar = 0.75*xyar;
+ end
-%-scene axis configuration-%
+ scene.aspectratio.x = 1.1*xyar;
+ scene.aspectratio.y = 1.0*xyar;
+ scene.aspectratio.z = zar;
-scene.xaxis.range = axisData.XLim;
-scene.yaxis.range = axisData.YLim;
-scene.zaxis.range = axisData.ZLim;
+ %---------------------------------------------------------------------%
-scene.xaxis.tickvals = axisData.XTick;
-scene.xaxis.ticktext = axisData.XTickLabel;
+ %-camera eye-%
+ ey = obj.PlotOptions.CameraEye;
-scene.yaxis.tickvals = axisData.YTick;
-scene.yaxis.ticktext = axisData.YTickLabel;
+ if ~isempty(ey)
+ if isvector(ey) && length(ey) == 3
+ scene.camera.eye.x = ey(1);
+ scene.camera.eye.y = ey(2);
+ scene.camera.eye.z = ey(3);
+ end
+ else
-scene.zaxis.tickvals = axisData.ZTick;
-scene.zaxis.ticktext = axisData.ZTickLabel;
+ %-define as default-%
+ xey = - xyar; if xey>0 xfac = -0.0; else xfac = 0.0; end
+ yey = - xyar; if yey>0 yfac = -0.3; else yfac = 0.3; end
+ if zar>0 zfac = -0.1; else zfac = 0.1; end
+
+ scene.camera.eye.x = xey + xfac*xey;
+ scene.camera.eye.y = yey + yfac*yey;
+ scene.camera.eye.z = zar + zfac*zar;
+ end
-scene.xaxis.zeroline = false;
-scene.yaxis.zeroline = false;
-scene.zaxis.zeroline = false;
+ %---------------------------------------------------------------------%
-scene.xaxis.showline = true;
-scene.yaxis.showline = true;
-scene.zaxis.showline = true;
+ %-scene axis configuration-%
-scene.xaxis.tickcolor = 'rgba(0,0,0,1)';
-scene.yaxis.tickcolor = 'rgba(0,0,0,1)';
-scene.zaxis.tickcolor = 'rgba(0,0,0,1)';
+ scene.xaxis.range = axisData.XLim;
+ scene.yaxis.range = axisData.YLim;
+ scene.zaxis.range = axisData.ZLim;
-scene.xaxis.ticklabelposition = 'outside';
-scene.yaxis.ticklabelposition = 'outside';
-scene.zaxis.ticklabelposition = 'outside';
+ scene.xaxis.tickvals = axisData.XTick;
+ scene.xaxis.ticktext = axisData.XTickLabel;
-scene.xaxis.title = axisData.XLabel.String;
-scene.yaxis.title = axisData.YLabel.String;
-scene.zaxis.title = axisData.ZLabel.String;
+ scene.yaxis.tickvals = axisData.YTick;
+ scene.yaxis.ticktext = axisData.YTickLabel;
-scene.xaxis.tickfont.size = axisData.FontSize;
-scene.yaxis.tickfont.size = axisData.FontSize;
-scene.zaxis.tickfont.size = axisData.FontSize;
+ scene.zaxis.tickvals = axisData.ZTick;
+ scene.zaxis.ticktext = axisData.ZTickLabel;
-scene.xaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
-scene.yaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
-scene.zaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
+ scene.xaxis.zeroline = false;
+ scene.yaxis.zeroline = false;
+ scene.zaxis.zeroline = false;
-%-------------------------------------------------------------------------%
+ scene.xaxis.showline = true;
+ scene.yaxis.showline = true;
+ scene.zaxis.showline = true;
-%-SET SCENE TO LAYOUT-%
-obj.layout = setfield(obj.layout, sprintf('scene%d', xsource), scene);
+ scene.xaxis.tickcolor = 'rgba(0,0,0,1)';
+ scene.yaxis.tickcolor = 'rgba(0,0,0,1)';
+ scene.zaxis.tickcolor = 'rgba(0,0,0,1)';
-%-------------------------------------------------------------------------%
+ scene.xaxis.ticklabelposition = 'outside';
+ scene.yaxis.ticklabelposition = 'outside';
+ scene.zaxis.ticklabelposition = 'outside';
-%-surface name-%
-obj.data{surfaceIndex}.name = meshData.DisplayName;
-obj.data{contourIndex}.name = meshData.DisplayName;
+ scene.xaxis.title = axisData.XLabel.String;
+ scene.yaxis.title = axisData.YLabel.String;
+ scene.zaxis.title = axisData.ZLabel.String;
-%-------------------------------------------------------------------------%
+ scene.xaxis.tickfont.size = axisData.FontSize;
+ scene.yaxis.tickfont.size = axisData.FontSize;
+ scene.zaxis.tickfont.size = axisData.FontSize;
-%-surface showscale-%
-obj.data{surfaceIndex}.showscale = false;
-obj.data{contourIndex}.showscale = false;
+ scene.xaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
+ scene.yaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
+ scene.zaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-surface visible-%
-obj.data{surfaceIndex}.visible = strcmp(meshData.Visible,'on');
-obj.data{contourIndex}.visible = strcmp(meshData.Visible,'on');
+ %-SET SCENE TO LAYOUT-%
+ obj.layout = setfield(obj.layout, sprintf('scene%d', xsource), scene);
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-leg = meshData.Annotation;
-legInfo = leg.LegendInformation;
+ obj.data{surfaceIndex}.name = meshData.DisplayName;
+ obj.data{contourIndex}.name = meshData.DisplayName;
+ obj.data{surfaceIndex}.showscale = false;
+ obj.data{contourIndex}.showscale = false;
+ obj.data{surfaceIndex}.visible = strcmp(meshData.Visible,'on');
+ obj.data{contourIndex}.visible = strcmp(meshData.Visible,'on');
-switch legInfo.IconDisplayStyle
- case 'on'
- showleg = true;
- case 'off'
- showleg = false;
-end
+ %---------------------------------------------------------------------%
-obj.data{surfaceIndex}.showlegend = showleg;
+ leg = meshData.Annotation;
+ legInfo = leg.LegendInformation;
-%-------------------------------------------------------------------------%
+ switch legInfo.IconDisplayStyle
+ case 'on'
+ showleg = true;
+ case 'off'
+ showleg = false;
+ end
+ obj.data{surfaceIndex}.showlegend = showleg;
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateSurfaceplot.m b/plotly/plotlyfig_aux/handlegraphics/updateSurfaceplot.m
index b1e383cd..2ade0da3 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateSurfaceplot.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateSurfaceplot.m
@@ -1,153 +1,115 @@
function obj = updateSurfaceplot(obj, surfaceIndex)
+ %-AXIS INDEX-%
+ axIndex = obj.getAxisIndex(obj.State.Plot(surfaceIndex).AssociatedAxis);
-%-AXIS INDEX-%
-axIndex = obj.getAxisIndex(obj.State.Plot(surfaceIndex).AssociatedAxis);
+ %-CHECK FOR MULTIPLE AXES-%
+ [xsource, ysource] = findSourceAxis(obj,axIndex);
-%-CHECK FOR MULTIPLE AXES-%
-[xsource, ysource] = findSourceAxis(obj,axIndex);
+ %-SURFACE DATA STRUCTURE- %
+ image_data = obj.State.Plot(surfaceIndex).Handle;
+ figure_data = obj.State.Figure.Handle;
-%-SURFACE DATA STRUCTURE- %
-image_data = obj.State.Plot(surfaceIndex).Handle;
-figure_data = obj.State.Figure.Handle;
+ %-AXIS DATA-%
+ xaxis = obj.layout.("xaxis" + xsource);
+ yaxis = obj.layout.("yaxis" + ysource);
-%-AXIS DATA-%
-xaxis = obj.layout.("xaxis" + xsource);
-yaxis = obj.layout.("yaxis" + ysource);
-
-%-------------------------------------------------------------------------%
-
-%-surface xaxis-%
-obj.data{surfaceIndex}.xaxis = ['x' num2str(xsource)];
-
-%-------------------------------------------------------------------------%
-
-%-surface yaxis-%
-obj.data{surfaceIndex}.yaxis = ['y' num2str(ysource)];
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-surface xaxis and yaxis-%
+ obj.data{surfaceIndex}.xaxis = ['x' num2str(xsource)];
+ obj.data{surfaceIndex}.yaxis = ['y' num2str(ysource)];
-% check for 3D
-if any(nonzeros(image_data.ZData))
-
- %---------------------------------------------------------------------%
-
- %-surface type-%
- obj.data{surfaceIndex}.type = 'surface';
-
%---------------------------------------------------------------------%
-
- %-format x an y data-%
- x = image_data.XData;
- y = image_data.YData;
- cdata = image_data.CData;
- if isvector(x)
- [x, y] = meshgrid(x,y);
+
+ % check for 3D
+ if any(nonzeros(image_data.ZData))
+
+ %-----------------------------------------------------------------%
+
+ %-surface type-%
+ obj.data{surfaceIndex}.type = 'surface';
+
+ %-----------------------------------------------------------------%
+
+ %-format x an y data-%
+ x = image_data.XData;
+ y = image_data.YData;
+ cdata = image_data.CData;
+ if isvector(x)
+ [x, y] = meshgrid(x,y);
+ end
+
+ %-----------------------------------------------------------------%
+
+ obj.data{surfaceIndex}.x = x;
+ obj.data{surfaceIndex}.y = y;
+ obj.data{surfaceIndex}.z = image_data.ZData;
+ obj.PlotOptions.Image3D = true;
+ obj.PlotOptions.ContourProjection = true;
+
+ %-----------------------------------------------------------------%
+
+ %- setting grid mesh by default -%
+ % x-direction
+ xmin = min(x(:));
+ xmax = max(x(:));
+ xsize = (xmax - xmin) / (size(x, 2)-1);
+ obj.data{surfaceIndex}.contours.x.start = xmin;
+ obj.data{surfaceIndex}.contours.x.end = xmax;
+ obj.data{surfaceIndex}.contours.x.size = xsize;
+ obj.data{surfaceIndex}.contours.x.show = true;
+ obj.data{surfaceIndex}.contours.x.color = 'black';
+ % y-direction
+ ymin = min(y(:));
+ ymax = max(y(:));
+ ysize = (ymax - ymin) / (size(y, 1)-1);
+ obj.data{surfaceIndex}.contours.y.start = ymin;
+ obj.data{surfaceIndex}.contours.y.end = ymax;
+ obj.data{surfaceIndex}.contours.y.size = ysize;
+ obj.data{surfaceIndex}.contours.y.show = true;
+ obj.data{surfaceIndex}.contours.y.color = 'black';
+ else
+ %-surface type-%
+ obj = updateImage(obj, surfaceIndex);
+
+ %-surface x-%
+ obj.data{surfaceIndex}.x = image_data.XData(1,:);
+
+ %-surface y-%
+ obj.data{surfaceIndex}.y = image_data.YData(:,1);
end
-
- %---------------------------------------------------------------------%
-
- %-surface x-%
- obj.data{surfaceIndex}.x = x;
%---------------------------------------------------------------------%
-
- %-surface y-%
- obj.data{surfaceIndex}.y = y;
-
- %---------------------------------------------------------------------%
-
- %-surface z-%
- obj.data{surfaceIndex}.z = image_data.ZData;
-
- %---------------------------------------------------------------------%
-
- %-if image comes would a 3D plot-%
- obj.PlotOptions.Image3D = true;
-
- %-if contour comes would a ContourProjection-%
- obj.PlotOptions.ContourProjection = true;
-
- %---------------------------------------------------------------------%
-
- %- setting grid mesh by default -%
- % x-direction
- xmin = min(x(:));
- xmax = max(x(:));
- xsize = (xmax - xmin) / (size(x, 2)-1);
- obj.data{surfaceIndex}.contours.x.start = xmin;
- obj.data{surfaceIndex}.contours.x.end = xmax;
- obj.data{surfaceIndex}.contours.x.size = xsize;
- obj.data{surfaceIndex}.contours.x.show = true;
- obj.data{surfaceIndex}.contours.x.color = 'black';
- % y-direction
- ymin = min(y(:));
- ymax = max(y(:));
- ysize = (ymax - ymin) / (size(y, 1)-1);
- obj.data{surfaceIndex}.contours.y.start = ymin;
- obj.data{surfaceIndex}.contours.y.end = ymax;
- obj.data{surfaceIndex}.contours.y.size = ysize;
- obj.data{surfaceIndex}.contours.y.show = true;
- obj.data{surfaceIndex}.contours.y.color = 'black';
-
-
-else
-
- %-surface type-%
- obj = updateImage(obj, surfaceIndex);
-
- %-surface x-%
- obj.data{surfaceIndex}.x = image_data.XData(1,:);
-
- %-surface y-%
- obj.data{surfaceIndex}.y = image_data.YData(:,1);
-end
-
-%-------------------------------------------------------------------------%
-%-image colorscale-%
+ %-image colorscale-%
-cmap = figure_data.Colormap;
-len = length(cmap)-1;
+ cmap = figure_data.Colormap;
+ len = length(cmap)-1;
-for c = 1: length(cmap)
- col = 255 * cmap(c, :);
- obj.data{surfaceIndex}.colorscale{c} = { (c-1)/len , ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')' ] };
-end
-
-%-------------------------------------------------------------------------%
-
-%-surface coloring-%
-obj.data{surfaceIndex}.surfacecolor = cdata;
-
-%-------------------------------------------------------------------------%
-
-%-surface name-%
-obj.data{surfaceIndex}.name = image_data.DisplayName;
-
-%-------------------------------------------------------------------------%
-
-%-surface showscale-%
-obj.data{surfaceIndex}.showscale = false;
-
-%-------------------------------------------------------------------------%
-
-%-surface visible-%
-obj.data{surfaceIndex}.visible = strcmp(image_data.Visible,'on');
+ for c = 1: length(cmap)
+ col = 255 * cmap(c, :);
+ obj.data{surfaceIndex}.colorscale{c} = ...
+ {(c-1)/len, sprintf("rgb(%f,%f,%f)", col)};
+ end
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-leg = image_data.Annotation;
-legInfo = leg.LegendInformation;
+ obj.data{surfaceIndex}.surfacecolor = cdata;
+ obj.data{surfaceIndex}.name = image_data.DisplayName;
+ obj.data{surfaceIndex}.showscale = false;
+ obj.data{surfaceIndex}.visible = strcmp(image_data.Visible,'on');
-switch legInfo.IconDisplayStyle
- case 'on'
- showleg = true;
- case 'off'
- showleg = false;
-end
+ %---------------------------------------------------------------------%
-obj.data{surfaceIndex}.showlegend = showleg;
+ leg = image_data.Annotation;
+ legInfo = leg.LegendInformation;
-%-------------------------------------------------------------------------%
+ switch legInfo.IconDisplayStyle
+ case 'on'
+ showleg = true;
+ case 'off'
+ showleg = false;
+ end
+ obj.data{surfaceIndex}.showlegend = showleg;
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateSurfc.m b/plotly/plotlyfig_aux/handlegraphics/updateSurfc.m
index 6a8656be..2f441768 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateSurfc.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateSurfc.m
@@ -1,5 +1,4 @@
function obj = updateSurfc(obj, dataIndex)
-
if strcmpi(obj.State.Plot(dataIndex).Class, 'surface')
surfaceIndex = dataIndex;
updateSurfOnly(obj, surfaceIndex)
@@ -7,11 +6,9 @@
contourIndex = dataIndex;
updateContourOnly(obj, contourIndex)
end
-
end
function updateContourOnly(obj, contourIndex)
-
%-AXIS INDEX-%
axIndex = obj.getAxisIndex(obj.State.Plot(contourIndex).AssociatedAxis);
@@ -26,18 +23,18 @@ function updateContourOnly(obj, contourIndex)
surfData = obj.State.Plot(contourIndex-1).Handle;
figureData = obj.State.Figure.Handle;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-associate scene-%
obj.data{contourIndex}.scene = sprintf('scene%d', xsource);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-scatter3d type for contour projection-%
obj.data{contourIndex}.type = 'scatter3d';
obj.data{contourIndex}.mode = 'lines';
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-get colormap-%
cMap = figureData.Colormap;
@@ -48,7 +45,7 @@ function updateContourOnly(obj, contourIndex)
colorScale{c} = { (c-1)*fac , sprintf('rgb(%f,%f,%f)', 255*cMap(c, :))};
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-get plot data-%
contourMatrix = contourData.ContourMatrix;
@@ -63,9 +60,6 @@ function updateContourOnly(obj, contourIndex)
n = 1;
while (n < len)
-
- %---------------------------------------------------------------------%
-
%-get plot data-%
m = contourMatrix(2, n);
zlevel = contourMatrix(1, n);
@@ -74,16 +68,14 @@ function updateContourOnly(obj, contourIndex)
yData = [yData, contourMatrix(2, n+1:n+m), NaN];
zData = [zData, zmin * ones(1, m), NaN];
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-get edge color-%
if isnumeric(contourData.LineColor)
cData = sprintf('rgb(%f,%f,%f)', 255*contourData.LineColor);
-
elseif strcmpi(contourData.LineColor, 'interp')
cData = zData;
obj.data{contourIndex}.line.colorscale = colorScale;
-
elseif strcmpi(contourData.LineColor, 'flat')
[err, r] = min(abs(surfData.ZData - zlevel));
[~, c] = min(err);
@@ -91,29 +83,26 @@ function updateContourOnly(obj, contourIndex)
cData = [cData, surfData.ZData(r, c) * ones(1, m), NaN];
obj.data{contourIndex}.line.colorscale = colorScale;
-
elseif strcmpi(contourData.LineColor, 'none')
cData = 'rgba(0,0,0,0)';
end
-
n = n + m + 1;
-
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set data on scatter3d-%
obj.data{contourIndex}.x = xData;
obj.data{contourIndex}.y = yData;
obj.data{contourIndex}.z = zData;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set edge color-%
obj.data{contourIndex}.line.color = cData;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-line style-%
@@ -130,27 +119,15 @@ function updateContourOnly(obj, contourIndex)
obj.data{contourIndex}.line.dash = 'dot';
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
- %-surface name-%
obj.data{contourIndex}.name = contourData.DisplayName;
-
- %-------------------------------------------------------------------------%
-
- %-surface showscale-%
obj.data{contourIndex}.showscale = false;
-
- %-------------------------------------------------------------------------%
-
- %-surface visible-%
obj.data{contourIndex}.visible = strcmp(contourData.Visible,'on');
-
- %-------------------------------------------------------------------------%
end
function updateSurfOnly(obj, surfaceIndex)
-
%-AXIS INDEX-%
axIndex = obj.getAxisIndex(obj.State.Plot(surfaceIndex).AssociatedAxis);
@@ -172,13 +149,13 @@ function updateSurfOnly(obj, surfaceIndex)
contourIndex = obj.PlotOptions.nPlots;
obj.PlotOptions.contourIndex(surfaceIndex) = contourIndex;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-associate scene-%
obj.data{surfaceIndex}.scene = sprintf('scene%d', xsource);
obj.data{contourIndex}.scene = sprintf('scene%d', xsource);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-surface type for face color-%
obj.data{surfaceIndex}.type = 'surface';
@@ -187,7 +164,7 @@ function updateSurfOnly(obj, surfaceIndex)
obj.data{contourIndex}.type = 'scatter3d';
obj.data{contourIndex}.mode = 'lines';
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-get plot data-%
xData = meshData.XData;
@@ -219,7 +196,7 @@ function updateSurfOnly(obj, surfaceIndex)
yDataContour = [yDataContourDir1(:); yDataContourDir2(:)];
zDataContour = [zDataContourDir1(:); zDataContourDir2(:)];
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set data on surface-%
obj.data{surfaceIndex}.x = xDataSurface;
@@ -241,18 +218,18 @@ function updateSurfOnly(obj, surfaceIndex)
obj.data{surfaceIndex}.contours.y.size = mean(diff(yData));;
obj.data{surfaceIndex}.contours.y.show = true;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set data on scatter3d-%
obj.data{contourIndex}.x = xDataContour(:);
obj.data{contourIndex}.y = yDataContour(:);
obj.data{contourIndex}.z = zDataContour(:);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-COLORING-%
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-get colormap-%
cMap = figureData.Colormap;
@@ -263,7 +240,7 @@ function updateSurfOnly(obj, surfaceIndex)
colorScale{c} = { (c-1)*fac , sprintf('rgb(%f,%f,%f)', 255*cMap(c, :))};
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-get edge color-%
if isnumeric(meshData.EdgeColor)
@@ -320,7 +297,7 @@ function updateSurfOnly(obj, surfaceIndex)
obj.data{surfaceIndex}.contours.x.color = cDataContour;
obj.data{surfaceIndex}.contours.y.color = cDataContour;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-get face color-%
faceColor = meshData.FaceColor;
@@ -413,7 +390,7 @@ function updateSurfOnly(obj, surfaceIndex)
%-opacity-%
obj.data{surfaceIndex}.opacity = meshData.FaceAlpha;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-line style-%
obj.data{contourIndex}.line.width = 3*meshData.LineWidth;
@@ -426,11 +403,11 @@ function updateSurfOnly(obj, surfaceIndex)
obj.data{surfaceIndex}.contours.y.show = false;
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-SCENE CONFIGUTATION-%
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-aspect ratio-%
asr = obj.PlotOptions.AspectRatio;
@@ -479,7 +456,7 @@ function updateSurfOnly(obj, surfaceIndex)
scene.camera.eye.z = zar + zfac*zar;
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-scene axis configuration-%
@@ -524,30 +501,30 @@ function updateSurfOnly(obj, surfaceIndex)
scene.yaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
scene.zaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-SET SCENE TO LAYOUT-%
obj.layout = setfield(obj.layout, sprintf('scene%d', xsource), scene);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-surface name-%
obj.data{surfaceIndex}.name = meshData.DisplayName;
obj.data{contourIndex}.name = meshData.DisplayName;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-surface showscale-%
obj.data{surfaceIndex}.showscale = false;
obj.data{contourIndex}.showscale = false;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-surface visible-%
obj.data{surfaceIndex}.visible = strcmp(meshData.Visible,'on');
obj.data{contourIndex}.visible = strcmp(meshData.Visible,'on');
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
leg = meshData.Annotation;
legInfo = leg.LegendInformation;
@@ -560,6 +537,4 @@ function updateSurfOnly(obj, surfaceIndex)
end
obj.data{surfaceIndex}.showlegend = showleg;
-
- %-------------------------------------------------------------------------%
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateSurfl.m b/plotly/plotlyfig_aux/handlegraphics/updateSurfl.m
index 46c998b8..a4d86390 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateSurfl.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateSurfl.m
@@ -1,414 +1,390 @@
function obj = updateSurfl(obj, surfaceIndex)
+ %-AXIS INDEX-%
+ axIndex = obj.getAxisIndex(obj.State.Plot(surfaceIndex).AssociatedAxis);
-%-AXIS INDEX-%
-axIndex = obj.getAxisIndex(obj.State.Plot(surfaceIndex).AssociatedAxis);
+ %-CHECK FOR MULTIPLE AXES-%
+ [xsource, ysource] = findSourceAxis(obj,axIndex);
-%-CHECK FOR MULTIPLE AXES-%
-[xsource, ysource] = findSourceAxis(obj,axIndex);
+ %-SURFACE DATA STRUCTURE- %
+ meshData = obj.State.Plot(surfaceIndex).Handle;
+ figureData = obj.State.Figure.Handle;
-%-SURFACE DATA STRUCTURE- %
-meshData = obj.State.Plot(surfaceIndex).Handle;
-figureData = obj.State.Figure.Handle;
+ %-AXIS STRUCTURE-%
+ axisData = ancestor(meshData.Parent,'axes');
-%-AXIS STRUCTURE-%
-axisData = ancestor(meshData.Parent,'axes');
+ %-SCENE DATA-%
+ scene = obj.layout.("scene" + xsource);
-%-SCENE DATA-%
-scene = obj.layout.("scene" + xsource);
+ %-GET CONTOUR INDEX-%
+ obj.PlotOptions.nPlots = obj.PlotOptions.nPlots + 1;
+ contourIndex = obj.PlotOptions.nPlots;
+ obj.PlotOptions.contourIndex(surfaceIndex) = contourIndex;
-%-GET CONTOUR INDEX-%
-obj.PlotOptions.nPlots = obj.PlotOptions.nPlots + 1;
-contourIndex = obj.PlotOptions.nPlots;
-obj.PlotOptions.contourIndex(surfaceIndex) = contourIndex;
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-associate scene-%
+ obj.data{surfaceIndex}.scene = sprintf('scene%d', xsource);
+ obj.data{contourIndex}.scene = sprintf('scene%d', xsource);
-%-associate scene-%
-obj.data{surfaceIndex}.scene = sprintf('scene%d', xsource);
-obj.data{contourIndex}.scene = sprintf('scene%d', xsource);
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-surface type for face color-%
+ obj.data{surfaceIndex}.type = 'surface';
+
+ %-scatter3d type for contour mesh lines-%
+ obj.data{contourIndex}.type = 'scatter3d';
+ obj.data{contourIndex}.mode = 'lines';
-%-surface type for face color-%
-obj.data{surfaceIndex}.type = 'surface';
-
-%-scatter3d type for contour mesh lines-%
-obj.data{contourIndex}.type = 'scatter3d';
-obj.data{contourIndex}.mode = 'lines';
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-get plot data-%
+ xData = meshData.XData;
+ yData = meshData.YData;
+ zData = meshData.ZData;
-%-get plot data-%
-xData = meshData.XData;
-yData = meshData.YData;
-zData = meshData.ZData;
+ %-reformat data to mesh-%
+ xDataSurface = xData;
+ yDataSurface = yData;
+ zDataSurface = zData;
-%-reformat data to mesh-%
-xDataSurface = xData;
-yDataSurface = yData;
-zDataSurface = zData;
+ xDataContourDir1 = [xDataSurface; NaN(1, size(xDataSurface, 2))];
+ yDataContourDir1 = [yDataSurface; NaN(1, size(yDataSurface, 2))];
+ zDataContourDir1 = [zDataSurface; NaN(1, size(zDataSurface, 2))];
-xDataContourDir1 = [xDataSurface; NaN(1, size(xDataSurface, 2))];
-yDataContourDir1 = [yDataSurface; NaN(1, size(yDataSurface, 2))];
-zDataContourDir1 = [zDataSurface; NaN(1, size(zDataSurface, 2))];
+ xDataContourDir2 = xDataContourDir1(1:end-1,:)';
+ yDataContourDir2 = yDataContourDir1(1:end-1,:)';
+ zDataContourDir2 = zDataContourDir1(1:end-1,:)';
-xDataContourDir2 = xDataContourDir1(1:end-1,:)';
-yDataContourDir2 = yDataContourDir1(1:end-1,:)';
-zDataContourDir2 = zDataContourDir1(1:end-1,:)';
+ xDataContourDir2 = [xDataContourDir2; NaN(1, size(xDataContourDir2, 2))];
+ yDataContourDir2 = [yDataContourDir2; NaN(1, size(yDataContourDir2, 2))];
+ zDataContourDir2 = [zDataContourDir2; NaN(1, size(zDataContourDir2, 2))];
-xDataContourDir2 = [xDataContourDir2; NaN(1, size(xDataContourDir2, 2))];
-yDataContourDir2 = [yDataContourDir2; NaN(1, size(yDataContourDir2, 2))];
-zDataContourDir2 = [zDataContourDir2; NaN(1, size(zDataContourDir2, 2))];
+ xDataContour = [xDataContourDir1(:); xDataContourDir2(:)];
+ yDataContour = [yDataContourDir1(:); yDataContourDir2(:)];
+ zDataContour = [zDataContourDir1(:); zDataContourDir2(:)];
-xDataContour = [xDataContourDir1(:); xDataContourDir2(:)];
-yDataContour = [yDataContourDir1(:); yDataContourDir2(:)];
-zDataContour = [zDataContourDir1(:); zDataContourDir2(:)];
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-set data on surface-%
+ obj.data{surfaceIndex}.x = xDataSurface;
+ obj.data{surfaceIndex}.y = yDataSurface;
+ obj.data{surfaceIndex}.z = zDataSurface;
-%-set data on surface-%
-obj.data{surfaceIndex}.x = xDataSurface;
-obj.data{surfaceIndex}.y = yDataSurface;
-obj.data{surfaceIndex}.z = zDataSurface;
+ %- setting grid mesh by default -%
+ % x-direction
+ xData = xData(1, :);
+ obj.data{surfaceIndex}.contours.x.start = xData(1);
+ obj.data{surfaceIndex}.contours.x.end = xData(end);
+ obj.data{surfaceIndex}.contours.x.size = mean(diff(xData));
+ obj.data{surfaceIndex}.contours.x.show = true;
-%- setting grid mesh by default -%
-% x-direction
-xData = xData(1, :);
-obj.data{surfaceIndex}.contours.x.start = xData(1);
-obj.data{surfaceIndex}.contours.x.end = xData(end);
-obj.data{surfaceIndex}.contours.x.size = mean(diff(xData));
-obj.data{surfaceIndex}.contours.x.show = true;
+ % y-direction
+ yData = yData(:, 1);
+ obj.data{surfaceIndex}.contours.y.start = yData(1);
+ obj.data{surfaceIndex}.contours.y.end = yData(end);
+ obj.data{surfaceIndex}.contours.y.size = mean(diff(yData));;
+ obj.data{surfaceIndex}.contours.y.show = true;
-% y-direction
-yData = yData(:, 1);
-obj.data{surfaceIndex}.contours.y.start = yData(1);
-obj.data{surfaceIndex}.contours.y.end = yData(end);
-obj.data{surfaceIndex}.contours.y.size = mean(diff(yData));;
-obj.data{surfaceIndex}.contours.y.show = true;
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-set data on scatter3d-%
+ obj.data{contourIndex}.x = xDataContour(:);
+ obj.data{contourIndex}.y = yDataContour(:);
+ obj.data{contourIndex}.z = zDataContour(:);
-%-set data on scatter3d-%
-obj.data{contourIndex}.x = xDataContour(:);
-obj.data{contourIndex}.y = yDataContour(:);
-obj.data{contourIndex}.z = zDataContour(:);
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-COLORING-%
-%-COLORING-%
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-get colormap-%
+ cMap = figureData.Colormap;
+ fac = 1/(length(cMap)-1);
+ colorScale = {};
-%-get colormap-%
-cMap = figureData.Colormap;
-fac = 1/(length(cMap)-1);
-colorScale = {};
-
-for c = 1: length(cMap)
- colorScale{c} = { (c-1)*fac , sprintf('rgb(%f,%f,%f)', 255*cMap(c, :))};
-end
-
-%-------------------------------------------------------------------------%
-
-%-get edge color-%
-if isnumeric(meshData.EdgeColor)
- cDataContour = sprintf('rgb(%f,%f,%f)', 255*meshData.EdgeColor);
-
-elseif strcmpi(meshData.EdgeColor, 'interp')
- cDataContour = zDataContour(:);
- obj.data{contourIndex}.line.colorscale = colorScale;
-
- obj.data{surfaceIndex}.contours.x.show = false;
- obj.data{surfaceIndex}.contours.y.show = false;
-
-elseif strcmpi(meshData.EdgeColor, 'flat')
- cData = meshData.CData;
-
- if size(cData, 3) ~= 1
- cMap = unique( reshape(cData, ...
- [size(cData,1)*size(cData,2), size(cData,3)]), 'rows' );
- cData = rgb2ind(cData, cMap);
+ for c = 1: length(cMap)
+ colorScale{c} = { (c-1)*fac , sprintf('rgb(%f,%f,%f)', 255*cMap(c, :))};
+ end
- edgeColorScale = {};
- fac = 1/(length(cMap)-1);
+ %---------------------------------------------------------------------%
- for c = 1: length(cMap)
- edgeColorScale{c} = { (c-1)*fac , sprintf('rgb(%f,%f,%f)', 255*cMap(c, :))};
- end
+ %-get edge color-%
+ if isnumeric(meshData.EdgeColor)
+ cDataContour = sprintf('rgb(%f,%f,%f)', 255*meshData.EdgeColor);
- obj.data{surfaceIndex}.line.cmin = 0;
- obj.data{surfaceIndex}.line.cmax = 255;
- obj.data{contourIndex}.line.colorscale = edgeColorScale;
- else
- obj.data{contourIndex}.line.cmin = axisData.CLim(1);
- obj.data{contourIndex}.line.cmax = axisData.CLim(2);
+ elseif strcmpi(meshData.EdgeColor, 'interp')
+ cDataContour = zDataContour(:);
obj.data{contourIndex}.line.colorscale = colorScale;
- end
- cDataContourDir1 = [cData; NaN(1, size(cData, 2))];
- cDataContourDir2 = cDataContourDir1(1:end-1,:)';
- cDataContourDir2 = [cDataContourDir2; NaN(1, size(cDataContourDir2, 2))];
- cDataContour = [cDataContourDir1(:); cDataContourDir2(:)];
+ obj.data{surfaceIndex}.contours.x.show = false;
+ obj.data{surfaceIndex}.contours.y.show = false;
- obj.data{surfaceIndex}.contours.x.show = false;
- obj.data{surfaceIndex}.contours.y.show = false;
+ elseif strcmpi(meshData.EdgeColor, 'flat')
+ cData = meshData.CData;
-elseif strcmpi(meshData.EdgeColor, 'none')
- cDataContour = 'rgba(0,0,0,0)';
- obj.data{surfaceIndex}.contours.x.show = false;
- obj.data{surfaceIndex}.contours.y.show = false;
+ if size(cData, 3) ~= 1
+ cMap = unique( reshape(cData, ...
+ [size(cData,1)*size(cData,2), size(cData,3)]), 'rows' );
+ cData = rgb2ind(cData, cMap);
-end
+ edgeColorScale = {};
+ fac = 1/(length(cMap)-1);
-%-set edge color-%
-obj.data{contourIndex}.line.color = cDataContour;
-obj.data{surfaceIndex}.contours.x.color = cDataContour;
-obj.data{surfaceIndex}.contours.y.color = cDataContour;
+ for c = 1: length(cMap)
+ edgeColorScale{c} = { (c-1)*fac , sprintf('rgb(%f,%f,%f)', 255*cMap(c, :))};
+ end
-%-------------------------------------------------------------------------%
-
-%-get face color-%
-faceColor = meshData.FaceColor;
-
-if isnumeric(faceColor)
+ obj.data{surfaceIndex}.line.cmin = 0;
+ obj.data{surfaceIndex}.line.cmax = 255;
+ obj.data{contourIndex}.line.colorscale = edgeColorScale;
+ else
+ obj.data{contourIndex}.line.cmin = axisData.CLim(1);
+ obj.data{contourIndex}.line.cmax = axisData.CLim(2);
+ obj.data{contourIndex}.line.colorscale = colorScale;
+ end
- if all(faceColor == [1, 1, 1])
- faceColor = [0.96, 0.96, 0.96];
- end
+ cDataContourDir1 = [cData; NaN(1, size(cData, 2))];
+ cDataContourDir2 = cDataContourDir1(1:end-1,:)';
+ cDataContourDir2 = [cDataContourDir2; NaN(1, size(cDataContourDir2, 2))];
+ cDataContour = [cDataContourDir1(:); cDataContourDir2(:)];
- for n = 1:size(zDataSurface, 2)
- for m = 1:size(zDataSurface, 1)
- cDataSurface(m, n, :) = faceColor;
- end
- end
+ obj.data{surfaceIndex}.contours.x.show = false;
+ obj.data{surfaceIndex}.contours.y.show = false;
- [cDataSurface, cMapSurface] = rgb2ind(cDataSurface, 256);
- cDataSurface = double(cDataSurface) + axisData.CLim(1);
+ elseif strcmpi(meshData.EdgeColor, 'none')
+ cDataContour = 'rgba(0,0,0,0)';
+ obj.data{surfaceIndex}.contours.x.show = false;
+ obj.data{surfaceIndex}.contours.y.show = false;
- for c = 1: size(cMapSurface, 1)
- colorScale{c} = { (c-1)*fac , sprintf('rgba(%f,%f,%f, 1)', cMapSurface(c, :))};
end
- obj.data{surfaceIndex}.cmin = axisData.CLim(1);
- obj.data{surfaceIndex}.cmax = axisData.CLim(2);
+ %-set edge color-%
+ obj.data{contourIndex}.line.color = cDataContour;
+ obj.data{surfaceIndex}.contours.x.color = cDataContour;
+ obj.data{surfaceIndex}.contours.y.color = cDataContour;
-elseif strcmpi(faceColor, 'interp')
- cDataSurface = zDataSurface;
+ %---------------------------------------------------------------------%
- if surfaceIndex > xsource
- cData = [];
+ %-get face color-%
+ faceColor = meshData.FaceColor;
- for idx = xsource:surfaceIndex
- cData = [cData; obj.data{idx}.z];
+ if isnumeric(faceColor)
+ if all(faceColor == [1, 1, 1])
+ faceColor = [0.96, 0.96, 0.96];
end
-
- cMin = min(cData(:));
- cMax = max(cData(:));
-
- for idx = xsource:surfaceIndex
- obj.data{idx}.cmin = cMin;
- obj.data{idx}.cmax = cMax;
+ for n = 1:size(zDataSurface, 2)
+ for m = 1:size(zDataSurface, 1)
+ cDataSurface(m, n, :) = faceColor;
+ end
end
- end
-
-elseif strcmpi(faceColor, 'flat')
- cData = meshData.CData;
-
- if size(cData, 3) ~= 1
- cMap = unique( reshape(cData, ...
- [size(cData,1)*size(cData,2), size(cData,3)]), 'rows' );
- cDataSurface = rgb2ind(cData, cMap);
-
- colorScale = {};
- fac = 1/(length(cMap)-1);
-
- for c = 1: length(cMap)
- colorScale{c} = { (c-1)*fac , sprintf('rgb(%f,%f,%f)', 255*cMap(c, :))};
+ [cDataSurface, cMapSurface] = rgb2ind(cDataSurface, 256);
+ cDataSurface = double(cDataSurface) + axisData.CLim(1);
+ for c = 1: size(cMapSurface, 1)
+ colorScale{c} = { (c-1)*fac , sprintf('rgba(%f,%f,%f, 1)', cMapSurface(c, :))};
end
- else
- cDataSurface = cData;
obj.data{surfaceIndex}.cmin = axisData.CLim(1);
obj.data{surfaceIndex}.cmax = axisData.CLim(2);
+ elseif strcmpi(faceColor, 'interp')
+ cDataSurface = zDataSurface;
+ if surfaceIndex > xsource
+ cData = [];
+ for idx = xsource:surfaceIndex
+ cData = [cData; obj.data{idx}.z];
+ end
+ cMin = min(cData(:));
+ cMax = max(cData(:));
+ for idx = xsource:surfaceIndex
+ obj.data{idx}.cmin = cMin;
+ obj.data{idx}.cmax = cMax;
+ end
+ end
+ elseif strcmpi(faceColor, 'flat')
+ cData = meshData.CData;
+ if size(cData, 3) ~= 1
+ cMap = unique( reshape(cData, ...
+ [size(cData,1)*size(cData,2), size(cData,3)]), 'rows' );
+ cDataSurface = rgb2ind(cData, cMap);
+ colorScale = {};
+ fac = 1/(length(cMap)-1);
+ for c = 1: length(cMap)
+ colorScale{c} = { (c-1)*fac , sprintf('rgb(%f,%f,%f)', 255*cMap(c, :))};
+ end
+ else
+ cDataSurface = cData;
+ obj.data{surfaceIndex}.cmin = axisData.CLim(1);
+ obj.data{surfaceIndex}.cmax = axisData.CLim(2);
+ end
end
-
-end
-%-set face color-%
-obj.data{surfaceIndex}.colorscale = colorScale;
-obj.data{surfaceIndex}.surfacecolor = cDataSurface;
+ %-set face color-%
+ obj.data{surfaceIndex}.colorscale = colorScale;
+ obj.data{surfaceIndex}.surfacecolor = cDataSurface;
-%-lighting settings-%
+ %-lighting settings-%
-if isnumeric(meshData.FaceColor) && all(meshData.FaceColor == [1, 1, 1])
- obj.data{surfaceIndex}.lighting.diffuse = 0.5;
- obj.data{surfaceIndex}.lighting.ambient = 0.725;
-else
- % obj.data{surfaceIndex}.lighting.diffuse = 1.0;
- % obj.data{surfaceIndex}.lighting.ambient = 0.9;
-end
+ if isnumeric(meshData.FaceColor) && all(meshData.FaceColor == [1, 1, 1])
+ obj.data{surfaceIndex}.lighting.diffuse = 0.5;
+ obj.data{surfaceIndex}.lighting.ambient = 0.725;
+ end
-if meshData.FaceAlpha ~= 1
- obj.data{surfaceIndex}.lighting.diffuse = 0.5;
- obj.data{surfaceIndex}.lighting.ambient = 0.725 + (1-meshData.FaceAlpha);
-end
+ if meshData.FaceAlpha ~= 1
+ obj.data{surfaceIndex}.lighting.diffuse = 0.5;
+ obj.data{surfaceIndex}.lighting.ambient = 0.725 + (1-meshData.FaceAlpha);
+ end
-if obj.PlotlyDefaults.IsLight
- obj.data{surfaceIndex}.lighting.diffuse = 1.0;
- obj.data{surfaceIndex}.lighting.ambient = 0.3;
-end
+ if obj.PlotlyDefaults.IsLight
+ obj.data{surfaceIndex}.lighting.diffuse = 1.0;
+ obj.data{surfaceIndex}.lighting.ambient = 0.3;
+ end
-%-opacity-%
-obj.data{surfaceIndex}.opacity = meshData.FaceAlpha;
+ %-opacity-%
+ obj.data{surfaceIndex}.opacity = meshData.FaceAlpha;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-line style-%
+ %-line style-%
-obj.data{contourIndex}.line.width = 3*meshData.LineWidth;
+ obj.data{contourIndex}.line.width = 3*meshData.LineWidth;
-if strcmpi(meshData.LineStyle, '-')
- obj.data{contourIndex}.line.dash = 'solid';
-else
- obj.data{contourIndex}.line.dash = 'dot';
- obj.data{surfaceIndex}.contours.x.show = false;
- obj.data{surfaceIndex}.contours.y.show = false;
-end
+ if strcmpi(meshData.LineStyle, '-')
+ obj.data{contourIndex}.line.dash = 'solid';
+ else
+ obj.data{contourIndex}.line.dash = 'dot';
+ obj.data{surfaceIndex}.contours.x.show = false;
+ obj.data{surfaceIndex}.contours.y.show = false;
+ end
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-SCENE CONFIGUTATION-%
+ %-SCENE CONFIGUTATION-%
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-aspect ratio-%
-asr = obj.PlotOptions.AspectRatio;
+ %-aspect ratio-%
+ asr = obj.PlotOptions.AspectRatio;
-if ~isempty(asr)
- if ischar(asr)
- scene.aspectmode = asr;
- elseif isvector(ar) && length(asr) == 3
- xar = asr(1);
- yar = asr(2);
- zar = asr(3);
+ if ~isempty(asr)
+ if ischar(asr)
+ scene.aspectmode = asr;
+ elseif isvector(ar) && length(asr) == 3
+ xar = asr(1);
+ yar = asr(2);
+ zar = asr(3);
+ end
+ else
+ %-define as default-%
+ xar = max(xData(:));
+ yar = max(yData(:));
+ xyar = max([xar, yar]);
+ zar = 0.75*xyar;
end
-else
- %-define as default-%
- xar = max(xData(:));
- yar = max(yData(:));
- xyar = max([xar, yar]);
- zar = 0.75*xyar;
-end
-
-scene.aspectratio.x = 1.1*xyar;
-scene.aspectratio.y = 1.0*xyar;
-scene.aspectratio.z = zar;
+ scene.aspectratio.x = 1.1*xyar;
+ scene.aspectratio.y = 1.0*xyar;
+ scene.aspectratio.z = zar;
-%---------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-camera eye-%
-ey = obj.PlotOptions.CameraEye;
+ %-camera eye-%
+ ey = obj.PlotOptions.CameraEye;
-if ~isempty(ey)
- if isvector(ey) && length(ey) == 3
- scene.camera.eye.x = ey(1);
- scene.camera.eye.y = ey(2);
- scene.camera.eye.z = ey(3);
+ if ~isempty(ey)
+ if isvector(ey) && length(ey) == 3
+ scene.camera.eye.x = ey(1);
+ scene.camera.eye.y = ey(2);
+ scene.camera.eye.z = ey(3);
+ end
+ else
+ %-define as default-%
+ xey = - xyar; if xey>0 xfac = -0.0; else xfac = 0.0; end
+ yey = - xyar; if yey>0 yfac = -0.3; else yfac = 0.3; end
+ if zar>0 zfac = -0.1; else zfac = 0.1; end
+
+ scene.camera.eye.x = xey + xfac*xey;
+ scene.camera.eye.y = yey + yfac*yey;
+ scene.camera.eye.z = zar + zfac*zar;
end
-else
-
- %-define as default-%
- xey = - xyar; if xey>0 xfac = -0.0; else xfac = 0.0; end
- yey = - xyar; if yey>0 yfac = -0.3; else yfac = 0.3; end
- if zar>0 zfac = -0.1; else zfac = 0.1; end
-
- scene.camera.eye.x = xey + xfac*xey;
- scene.camera.eye.y = yey + yfac*yey;
- scene.camera.eye.z = zar + zfac*zar;
-end
-
-%-------------------------------------------------------------------------%
-%-scene axis configuration-%
+ %---------------------------------------------------------------------%
-scene.xaxis.range = axisData.XLim;
-scene.yaxis.range = axisData.YLim;
-scene.zaxis.range = axisData.ZLim;
+ %-scene axis configuration-%
-scene.xaxis.tickvals = axisData.XTick;
-scene.xaxis.ticktext = axisData.XTickLabel;
+ scene.xaxis.range = axisData.XLim;
+ scene.yaxis.range = axisData.YLim;
+ scene.zaxis.range = axisData.ZLim;
-scene.yaxis.tickvals = axisData.YTick;
-scene.yaxis.ticktext = axisData.YTickLabel;
+ scene.xaxis.tickvals = axisData.XTick;
+ scene.xaxis.ticktext = axisData.XTickLabel;
-scene.zaxis.tickvals = axisData.ZTick;
-scene.zaxis.ticktext = axisData.ZTickLabel;
+ scene.yaxis.tickvals = axisData.YTick;
+ scene.yaxis.ticktext = axisData.YTickLabel;
-scene.xaxis.zeroline = false;
-scene.yaxis.zeroline = false;
-scene.zaxis.zeroline = false;
+ scene.zaxis.tickvals = axisData.ZTick;
+ scene.zaxis.ticktext = axisData.ZTickLabel;
-scene.xaxis.showline = true;
-scene.yaxis.showline = true;
-scene.zaxis.showline = true;
+ scene.xaxis.zeroline = false;
+ scene.yaxis.zeroline = false;
+ scene.zaxis.zeroline = false;
-scene.xaxis.tickcolor = 'rgba(0,0,0,1)';
-scene.yaxis.tickcolor = 'rgba(0,0,0,1)';
-scene.zaxis.tickcolor = 'rgba(0,0,0,1)';
+ scene.xaxis.showline = true;
+ scene.yaxis.showline = true;
+ scene.zaxis.showline = true;
-scene.xaxis.ticklabelposition = 'outside';
-scene.yaxis.ticklabelposition = 'outside';
-scene.zaxis.ticklabelposition = 'outside';
+ scene.xaxis.tickcolor = 'rgba(0,0,0,1)';
+ scene.yaxis.tickcolor = 'rgba(0,0,0,1)';
+ scene.zaxis.tickcolor = 'rgba(0,0,0,1)';
-scene.xaxis.title = axisData.XLabel.String;
-scene.yaxis.title = axisData.YLabel.String;
-scene.zaxis.title = axisData.ZLabel.String;
+ scene.xaxis.ticklabelposition = 'outside';
+ scene.yaxis.ticklabelposition = 'outside';
+ scene.zaxis.ticklabelposition = 'outside';
-scene.xaxis.tickfont.size = axisData.FontSize;
-scene.yaxis.tickfont.size = axisData.FontSize;
-scene.zaxis.tickfont.size = axisData.FontSize;
+ scene.xaxis.title = axisData.XLabel.String;
+ scene.yaxis.title = axisData.YLabel.String;
+ scene.zaxis.title = axisData.ZLabel.String;
-scene.xaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
-scene.yaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
-scene.zaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
+ scene.xaxis.tickfont.size = axisData.FontSize;
+ scene.yaxis.tickfont.size = axisData.FontSize;
+ scene.zaxis.tickfont.size = axisData.FontSize;
-%-------------------------------------------------------------------------%
+ scene.xaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
+ scene.yaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
+ scene.zaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
-%-SET SCENE TO LAYOUT-%
-obj.layout = setfield(obj.layout, sprintf('scene%d', xsource), scene);
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-SET SCENE TO LAYOUT-%
+ obj.layout = setfield(obj.layout, sprintf('scene%d', xsource), scene);
-%-surface name-%
-obj.data{surfaceIndex}.name = meshData.DisplayName;
-obj.data{contourIndex}.name = meshData.DisplayName;
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-surface name-%
+ obj.data{surfaceIndex}.name = meshData.DisplayName;
+ obj.data{contourIndex}.name = meshData.DisplayName;
-%-surface showscale-%
-obj.data{surfaceIndex}.showscale = false;
-obj.data{contourIndex}.showscale = false;
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-surface showscale-%
+ obj.data{surfaceIndex}.showscale = false;
+ obj.data{contourIndex}.showscale = false;
-%-surface visible-%
-obj.data{surfaceIndex}.visible = strcmp(meshData.Visible,'on');
-obj.data{contourIndex}.visible = strcmp(meshData.Visible,'on');
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-surface visible-%
+ obj.data{surfaceIndex}.visible = strcmp(meshData.Visible,'on');
+ obj.data{contourIndex}.visible = strcmp(meshData.Visible,'on');
-leg = meshData.Annotation;
-legInfo = leg.LegendInformation;
+ %---------------------------------------------------------------------%
-switch legInfo.IconDisplayStyle
- case 'on'
- showleg = true;
- case 'off'
- showleg = false;
-end
-
-obj.data{surfaceIndex}.showlegend = showleg;
+ leg = meshData.Annotation;
+ legInfo = leg.LegendInformation;
-%-------------------------------------------------------------------------%
+ switch legInfo.IconDisplayStyle
+ case 'on'
+ showleg = true;
+ case 'off'
+ showleg = false;
+ end
+ obj.data{surfaceIndex}.showlegend = showleg;
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateTernaryContour.m b/plotly/plotlyfig_aux/handlegraphics/updateTernaryContour.m
index a9ed9c19..aa004460 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateTernaryContour.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateTernaryContour.m
@@ -1,5 +1,4 @@
function obj = updateTernaryContour(obj, ternaryIndex)
-
%-AXIS INDEX-%
axIndex = obj.getAxisIndex(obj.State.Plot(ternaryIndex).AssociatedAxis);
@@ -11,21 +10,21 @@
%-CHECK FOR MULTIPLE AXES-%
[xsource, ysource] = findSourceAxis(obj, axIndex);
- %=========================================================================%
+ %=====================================================================%
%
%-UPDATE CONTOURS FILL-%
%
- %=========================================================================%
+ %=====================================================================%
if strcmpi(ternaryData.Fill, 'on')
fillContours(obj, ternaryIndex)
end
- %=========================================================================%
+ %=====================================================================%
%
%-UPDATE CONTOUR LINES-%
%
- %=========================================================================%
+ %=====================================================================%
%-parse plot data-%
contourMatrix = ternaryData.ContourMatrix;
@@ -35,7 +34,7 @@
while (n < len)
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-get plot data-%
m = contourMatrix(2, n);
@@ -44,7 +43,7 @@
xData{c} = contourMatrix(1, n+1:n+m);
yData{c} = contourMatrix(2, n+1:n+m);
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-get edge color-%
if isnumeric(ternaryData.LineColor)
@@ -71,17 +70,14 @@
n = n + m + 1;
c = c + 1;
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set contour lines-%
for c = 1:length(xData)
-
- %---------------------------------------------------------------------%
-
%-get trace index-%
traceIndex = ternaryIndex;
@@ -90,14 +86,14 @@
traceIndex = obj.PlotOptions.nPlots;
end
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-set trace-%
obj.data{traceIndex}.type = 'scatterternary';
obj.data{traceIndex}.mode = 'lines';
obj.data{traceIndex}.subplot = sprintf('ternary%d', xsource+1);
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-convert from cartesian coordinates to trenary points-%
aData = yData{c}/sin(deg2rad(60));
@@ -107,7 +103,7 @@
obj.data{traceIndex}.a = aData;
obj.data{traceIndex}.b = bData;
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-line settings-%
obj.data{traceIndex}.line.width = 1.0*ternaryData.LineWidth;
@@ -124,14 +120,14 @@
obj.data{traceIndex}.line.dash = 'dot';
end
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-some trace settings-%
obj.data{traceIndex}.name = ternaryData.DisplayName;
obj.data{traceIndex}.showscale = false;
obj.data{traceIndex}.visible = strcmp(ternaryData.Visible,'on');
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-trace legend-%
% leg = get(ternaryData.Annotation);
@@ -147,18 +143,16 @@
% obj.data{traceIndex}.showlegend = showleg;
obj.data{traceIndex}.showlegend = false;
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
end
- %=========================================================================%
+ %=====================================================================%
%
%-UPDATE TERNARY AXES-%
%
- %=========================================================================%
+ %=====================================================================%
ternaryAxes(obj, ternaryIndex)
-
- %-------------------------------------------------------------------------%
end
@@ -175,7 +169,7 @@ function fillContours(obj, ternaryIndex)
%-CHECK FOR MULTIPLE AXES-%
[xsource, ysource] = findSourceAxis(obj, axIndex);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-get zLevels-%
contourMatrix = ternaryData.ContourMatrix;
@@ -192,7 +186,7 @@ function fillContours(obj, ternaryIndex)
zLevel = sort(zLevel);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-get close contours-%
resizeScale = 1000/mean(size(ternaryData.XData));
@@ -250,7 +244,7 @@ function fillContours(obj, ternaryIndex)
c = c + 1;
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-sort contours by area size-%
[~, idx] = sort(contourArea, 'descend');
@@ -265,13 +259,10 @@ function fillContours(obj, ternaryIndex)
yData = yDataSorted;
lineColor = lineColorSorted;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set contour fill-%
for c = 1:length(xData)
-
- %---------------------------------------------------------------------%
-
%-get trace index-%
traceIndex = ternaryIndex;
@@ -280,14 +271,14 @@ function fillContours(obj, ternaryIndex)
traceIndex = obj.PlotOptions.nPlots;
end
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-set trace-%
obj.data{traceIndex}.type = 'scatterternary';
obj.data{traceIndex}.mode = 'lines';
obj.data{traceIndex}.subplot = sprintf('ternary%d', xsource+1);
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-convert from cartesian coordinates to trenary points-%
aData = yData{c}/sin(deg2rad(60));
@@ -297,7 +288,7 @@ function fillContours(obj, ternaryIndex)
obj.data{traceIndex}.a = aData;
obj.data{traceIndex}.b = bData;
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-line settings-%
obj.data{traceIndex}.line.color = lineColor{c};
@@ -316,30 +307,27 @@ function fillContours(obj, ternaryIndex)
obj.data{traceIndex}.line.dash = 'dot';
end
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-fill settings-%
obj.data{traceIndex}.fill = 'toself';
obj.data{traceIndex}.fillcolor = lineColor{c};
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-some trace settings-%
obj.data{traceIndex}.name = ternaryData.DisplayName;
obj.data{traceIndex}.showscale = false;
obj.data{traceIndex}.visible = strcmp(ternaryData.Visible,'on');
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-trace legend-%
obj.data{traceIndex}.showlegend = false;
-
- %---------------------------------------------------------------------%
end
end
function ternaryAxes(obj, ternaryIndex)
-
%-AXIS INDEX-%
axIndex = obj.getAxisIndex(obj.State.Plot(ternaryIndex).AssociatedAxis);
@@ -349,7 +337,7 @@ function ternaryAxes(obj, ternaryIndex)
%-CHECK FOR MULTIPLE AXES-%
[xsource, ysource] = findSourceAxis(obj, axIndex);
- %-----------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set domain plot-%
xo = axisData.Position(1);
@@ -360,7 +348,7 @@ function ternaryAxes(obj, ternaryIndex)
ternary.domain.x = min([xo xo + w],1);
ternary.domain.y = min([yo yo + h],1);
- %-----------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-label settings-%
l = 1; t = 1;
@@ -394,7 +382,7 @@ function ternaryAxes(obj, ternaryIndex)
ternary.(labelLetter(l) + "axis").title.font.family = labelFontFamily;
end
- %-----------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-tick settings-%
t0 = tickIndex(1); t1 = tickIndex(2);
@@ -414,20 +402,17 @@ function ternaryAxes(obj, ternaryIndex)
ternary.(labelLetter{l} + "axis").tickfont.family = tickFontFamily;
end
- %-----------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set ternary axes to layout-%
obj.layout = setfield(obj.layout, sprintf('ternary%d', xsource+1), ternary);
- %-----------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
obj.PlotlyDefaults.isTernary = true;
-
- %-----------------------------------------------------------------------------%
end
function rad = deg2rad(deg)
-
rad = deg / 180 * pi;
end
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateTernaryPlot.m b/plotly/plotlyfig_aux/handlegraphics/updateTernaryPlot.m
index a214fe7e..f457c201 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateTernaryPlot.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateTernaryPlot.m
@@ -1,5 +1,4 @@
function obj = updateTernaryPlot(obj, ternaryIndex)
-
%-AXIS INDEX-%
axIndex = obj.getAxisIndex(obj.State.Plot(ternaryIndex).AssociatedAxis);
@@ -14,11 +13,11 @@
%-ASSOCIATE TERNARY-AXES WITH LAYOUT-%
obj.data{ternaryIndex}.subplot = sprintf('ternary%d', xsource+1);
- %=========================================================================%
+ %=====================================================================%
%
%-UPDATE TRACE PLOT-%
%
- %=========================================================================%
+ %=====================================================================%
%-set trace-%
obj.data{ternaryIndex}.type = 'scatterternary';
@@ -33,7 +32,7 @@
obj.data{ternaryIndex}.mode = 'none';
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-get plot data-%
xData = ternaryData.XData;
@@ -47,7 +46,7 @@
obj.data{ternaryIndex}.a = aData;
obj.data{ternaryIndex}.b = bData;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-trace line settings-%
obj.data{ternaryIndex}.line = extractLineLine(ternaryData);
@@ -58,7 +57,7 @@
obj.data{ternaryIndex}.showscale = false;
obj.data{ternaryIndex}.visible = strcmp(ternaryData.Visible,'on');
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-legend-%
leg = ternaryData.Annotation;
@@ -73,11 +72,11 @@
obj.data{ternaryIndex}.showlegend = showleg;
- %=========================================================================%
+ %=====================================================================%
%
%-UPDATE TERNARY AXES-%
%
- %=========================================================================%
+ %=====================================================================%
%-set domain plot-%
xo = axisData.Position(1);
@@ -88,7 +87,7 @@
ternary.domain.x = min([xo xo + w],1);
ternary.domain.y = min([yo yo + h],1);
- %-----------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-label settings-%
l = 1; t = 1;
@@ -97,7 +96,6 @@
for n = 1:length(axisData.Children)
if strcmpi(axisData.Children(n).Type, 'text')
stringText = axisData.Children(n).String;
-
if any(isletter(stringText))
labelIndex(l) = n;
l = l + 1;
@@ -122,7 +120,7 @@
ternary.(labelLetter{l} + "axis").title.font.family = labelFontFamily;
end
- %-----------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-tick settings-%
t0 = tickIndex(1); t1 = tickIndex(2);
@@ -142,17 +140,14 @@
ternary.(labelLetter{l} + "axis").tickfont.family = tickFontFamily;
end
- %-----------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set ternary axes to layout-%
obj.layout = setfield(obj.layout, sprintf('ternary%d', xsource+1), ternary);
- %-----------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
obj.PlotlyDefaults.isTernary = true;
-
- %-----------------------------------------------------------------------------%
-
end
function rad = deg2rad(deg)
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateTernaryPlotPro.m b/plotly/plotlyfig_aux/handlegraphics/updateTernaryPlotPro.m
index 38c84c79..f4b2bdd3 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateTernaryPlotPro.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateTernaryPlotPro.m
@@ -1,5 +1,4 @@
function obj = updateTernaryPlotPro(obj, ternaryIndex)
-
%-AXIS INDEX-%
axIndex = obj.getAxisIndex(obj.State.Plot(ternaryIndex).AssociatedAxis);
@@ -11,36 +10,33 @@
%-CHECK FOR MULTIPLE AXES-%
[xsource, ysource] = findSourceAxis(obj, axIndex);
- %=========================================================================%
+ %=====================================================================%
%
%-UPDATE TRACE PLOT-%
%
- %=========================================================================%
+ %=====================================================================%
%-get plot data-%
xData = ternaryData.XData;
yData = ternaryData.YData;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set trace-%
for t = 1:size(xData,2)
-
- %-------------------------------------------------------------------------%
-
%-get new ternaryIndex-%
if t > 1
obj.PlotOptions.nPlots = obj.PlotOptions.nPlots + 1;
ternaryIndex = obj.PlotOptions.nPlots;
end
- %-------------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-trace type-%
obj.data{ternaryIndex}.type = 'scatterternary';
obj.data{ternaryIndex}.subplot = sprintf('ternary%d', xsource+1);
- %-------------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-set mode and properties for trace-%
if ~strcmpi('none', ternaryData.Marker) && ~strcmpi('none', ternaryData.LineStyle)
@@ -59,7 +55,7 @@
obj.data{ternaryIndex}.mode = 'none';
end
- %-------------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-convert from cartesian coordinates to trenary points-%
yTernData = yData(:,t); yTernData(end+1) = yData(1,t);
@@ -68,13 +64,13 @@
aData = yTernData/sin(deg2rad(60));
bData = 1 - xTernData - yTernData*cot(deg2rad(60));
- %-------------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-set plot data-%
obj.data{ternaryIndex}.a = aData;
obj.data{ternaryIndex}.b = bData;
- %-------------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-some trace properties-%
obj.data{ternaryIndex}.name = ternaryData.DisplayName;
@@ -90,32 +86,23 @@
else
cMap = figureData.Colormap;
nColors = size(cMap,1);
-
switch faceColor
-
case 'none'
fillColor = 'rgba(0,0,0,0)';
-
case {'flat', 'interp'}
-
switch ternaryData.CDataMapping
-
case 'scaled'
cMin = axisData.CLim(1);
cMax = axisData.CLim(2);
-
if strcmpi(faceColor, 'flat')
cData = ternaryData.ZData(1,t);
elseif strcmpi(faceColor, 'interp')
cData = max(ternaryData.ZData(:,t));
end
-
cData = max(min(cData, cMax), cMin);
cData = (cData - cMin)/diff(axisData.CLim);
cData = 1 + floor( cData*(nColors-1) );
-
fillColor = sprintf('rgb(%f,%f,%f)', 255*cMap(cData,:));
-
case 'direct'
fillColor = sprintf('rgb(%f,%f,%f)', 255*cMap(ternary(1,t),:));
end
@@ -125,19 +112,17 @@
obj.data{ternaryIndex}.fillcolor = fillColor;
obj.data{ternaryIndex}.fill = 'toself';
- %---------------------------------------------------------------------%
+ %-----------------------------------------------------------------%
%-trace legend-%
obj.data{ternaryIndex}.showlegend = false;
-
- %-------------------------------------------------------------------------%
end
- %=========================================================================%
+ %=====================================================================%
%
%-UPDATE TERNARY AXES-%
%
- %=========================================================================%
+ %=====================================================================%
%-set domain plot-%
xo = axisData.Position(1);
@@ -148,7 +133,7 @@
ternary.domain.x = min([xo xo + w],1);
ternary.domain.y = min([yo yo + h],1);
- %-----------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-label settings-%
l = 1; t = 1;
@@ -182,7 +167,7 @@
ternary.(labelLetter{l} + "axis").title.font.family = labelFontFamily;
end
- %-----------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-tick settings-%
t0 = tickIndex(1); t1 = tickIndex(2);
@@ -202,16 +187,14 @@
ternary.(labelLetter{l} + "axis").tickfont.family = tickFontFamily;
end
- %-----------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-set ternary axes to layout-%
obj.layout = setfield(obj.layout, sprintf('ternary%d', xsource+1), ternary);
- %-----------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
obj.PlotlyDefaults.isTernary = true;
-
- %-----------------------------------------------------------------------------%
end
function rad = deg2rad(deg)
diff --git a/plotly/plotlyfig_aux/handlegraphics/updateWordcloud.m b/plotly/plotlyfig_aux/handlegraphics/updateWordcloud.m
index 1610524c..d6914a42 100644
--- a/plotly/plotlyfig_aux/handlegraphics/updateWordcloud.m
+++ b/plotly/plotlyfig_aux/handlegraphics/updateWordcloud.m
@@ -1,167 +1,165 @@
function updateWordcloud(obj,scatterIndex)
+ %-AXIS INDEX-%
+ axIndex = obj.getAxisIndex(obj.State.Plot(scatterIndex).AssociatedAxis);
-%-AXIS INDEX-%
-axIndex = obj.getAxisIndex(obj.State.Plot(scatterIndex).AssociatedAxis);
+ %-SCATTER DATA STRUCTURE- %
+ scatter_data = obj.State.Plot(scatterIndex).Handle;
-%-SCATTER DATA STRUCTURE- %
-scatter_data = obj.State.Plot(scatterIndex).Handle;
+ %-CHECK FOR MULTIPLE AXES-%
+ [xsource, ysource] = findSourceAxis(obj,axIndex);
-%-CHECK FOR MULTIPLE AXES-%
-[xsource, ysource] = findSourceAxis(obj,axIndex);
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-scatter type-%
+ obj.data{scatterIndex}.type = 'scatter';
-%-scatter type-%
-obj.data{scatterIndex}.type = 'scatter';
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-format the mesh domain-%
+ maxx = scatter_data.MaxDisplayWords;
+ npoints = round(sqrt(maxx));
-%-format the mesh domain-%
-maxx = scatter_data.MaxDisplayWords;
-npoints = round(sqrt(maxx));
-
-if mod(npoints, 2) == 0
- npoints = npoints+1;
-end
+ if mod(npoints, 2) == 0
+ npoints = npoints+1;
+ end
-xdomain = linspace(1, maxx, npoints);
-ydomain = linspace(1, maxx*.7, npoints);
+ xdomain = linspace(1, maxx, npoints);
+ ydomain = linspace(1, maxx*.7, npoints);
-[xdata, ydata] = meshgrid(xdomain, ydomain);
-xrand = diff(xdomain(1:2)) * (rand(size(xdata)) - 0.5);
-yrand = diff(ydomain(1:2)) * (rand(size(ydata)) - 0.5);
-xdata = xdata + xrand;
-ydata = ydata + yrand;
+ [xdata, ydata] = meshgrid(xdomain, ydomain);
+ xrand = diff(xdomain(1:2)) * (rand(size(xdata)) - 0.5);
+ yrand = diff(ydomain(1:2)) * (rand(size(ydata)) - 0.5);
+ xdata = xdata + xrand;
+ ydata = ydata + yrand;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-make oval effect-%
-inds = (xdata-0.5*xdomain(end)).^2 + (ydata-0.5*ydomain(end)).^2 < (0.5*maxx)^2;
-xdata(~inds) = NaN;
-ydata(~inds) = NaN;
+ %-make oval effect-%
+ inds = (xdata-0.5*xdomain(end)).^2 + (ydata-0.5*ydomain(end)).^2 < (0.5*maxx)^2;
+ xdata(~inds) = NaN;
+ ydata(~inds) = NaN;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-get frequency-%
-[B, inds] = sort(scatter_data.SizeData, 'descend');
+ %-get frequency-%
+ [B, inds] = sort(scatter_data.SizeData, 'descend');
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-take more freq words-%
-nwords = numel(xdata);
-inds = inds(1:nwords);
+ %-take more freq words-%
+ nwords = numel(xdata);
+ inds = inds(1:nwords);
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-get indices for distribution-%
-middle = round(nwords*0.5);
-inds = inds(mod([1:nwords] + middle, nwords)+1);
-inds_aux = inds;
-inds1 = round(linspace(1,middle-1, round(middle/2)));
-inds2 = round(linspace(nwords,middle+1, round(middle/2)));
-inds(inds1) = inds_aux(inds2);
-inds(inds2) = inds_aux(inds1);
+ %-get indices for distribution-%
+ middle = round(nwords*0.5);
+ inds = inds(mod([1:nwords] + middle, nwords)+1);
+ inds_aux = inds;
+ inds1 = round(linspace(1,middle-1, round(middle/2)));
+ inds2 = round(linspace(nwords,middle+1, round(middle/2)));
+ inds(inds1) = inds_aux(inds2);
+ inds(inds2) = inds_aux(inds1);
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-exchange columns-%
-inds = reshape(inds, size(xdata));
-inds_aux = inds;
-mc = round(0.5*size(inds_aux, 2));
+ %-exchange columns-%
+ inds = reshape(inds, size(xdata));
+ inds_aux = inds;
+ mc = round(0.5*size(inds_aux, 2));
-inds(:,mc-2) = inds_aux(:,mc-1);
-inds(:,mc-1) = inds_aux(:,mc-2);
-inds(:,mc+1) = inds_aux(:,mc+2);
-inds(:,mc+2) = inds_aux(:,mc+1);
-inds = inds(:);
+ inds(:,mc-2) = inds_aux(:,mc-1);
+ inds(:,mc-1) = inds_aux(:,mc-2);
+ inds(:,mc+1) = inds_aux(:,mc+2);
+ inds(:,mc+2) = inds_aux(:,mc+1);
+ inds = inds(:);
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-get data to wordcloud-%
+ %-get data to wordcloud-%
-% sizedata
-sizedata = scatter_data.SizeData(inds);
+ % sizedata
+ sizedata = scatter_data.SizeData(inds);
-% worddata
-worddata = cell(nwords,1);
-for w = 1:nwords
- worddata{w} = char(scatter_data.WordData(inds(w)));
-end
+ % worddata
+ worddata = cell(nwords,1);
+ for w = 1:nwords
+ worddata{w} = char(scatter_data.WordData(inds(w)));
+ end
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-sent data to plotly-%
-obj.data{scatterIndex}.mode = 'text';
-obj.data{scatterIndex}.x = xdata(:);
-obj.data{scatterIndex}.y = ydata(:);
-obj.data{scatterIndex}.text = worddata;
-obj.data{scatterIndex}.textfont.size = sizedata;
+ %-sent data to plotly-%
+ obj.data{scatterIndex}.mode = 'text';
+ obj.data{scatterIndex}.x = xdata(:);
+ obj.data{scatterIndex}.y = ydata(:);
+ obj.data{scatterIndex}.text = worddata;
+ obj.data{scatterIndex}.textfont.size = sizedata;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-coloring-%
-is_colormap = size(scatter_data.Color, 1) > 1;
-col = cell(nwords, 1);
+ %-coloring-%
+ is_colormap = size(scatter_data.Color, 1) > 1;
+ col = cell(nwords, 1);
-if ~is_colormap
- for w=1:nwords
- if B(4) > sizedata(w)
- col{w} = sprintf('rgb(%f,%f,%f)', scatter_data.Color*255);
- else
- col{w} = sprintf('rgb(%f,%f,%f)', scatter_data.HighlightColor*255);
+ if ~is_colormap
+ for w=1:nwords
+ if B(4) > sizedata(w)
+ col{w} = sprintf('rgb(%f,%f,%f)', scatter_data.Color*255);
+ else
+ col{w} = sprintf('rgb(%f,%f,%f)', scatter_data.HighlightColor*255);
+ end
+ end
+ else
+ for w=1:nwords
+ col{w} = sprintf('rgb(%f,%f,%f)', scatter_data.Color(inds(w), :)*255);
end
end
-else
- for w=1:nwords
- col{w} = sprintf('rgb(%f,%f,%f)', scatter_data.Color(inds(w), :)*255);
- end
-end
-obj.data{scatterIndex}.textfont.color = col;
+ obj.data{scatterIndex}.textfont.color = col;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-det font family-%
-obj.data{scatterIndex}.textfont.family = matlab2plotlyfont(scatter_data.FontName);
+ %-det font family-%
+ obj.data{scatterIndex}.textfont.family = matlab2plotlyfont(scatter_data.FontName);
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-scatter visible-%
-obj.data{scatterIndex}.visible = strcmp(scatter_data.Visible,'on');
+ %-scatter visible-%
+ obj.data{scatterIndex}.visible = strcmp(scatter_data.Visible,'on');
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-set layout-%
-xaxis.showgrid = false;
-xaxis.showticklabels = false;
-xaxis.zeroline = false;
+ %-set layout-%
+ xaxis.showgrid = false;
+ xaxis.showticklabels = false;
+ xaxis.zeroline = false;
-yaxis.showgrid = false;
-yaxis.showticklabels = false;
-yaxis.zeroline = false;
+ yaxis.showgrid = false;
+ yaxis.showticklabels = false;
+ yaxis.zeroline = false;
-xo = scatter_data.Position(1);
-yo = scatter_data.Position(2);
-w = scatter_data.Position(3);
-h = scatter_data.Position(4);
+ xo = scatter_data.Position(1);
+ yo = scatter_data.Position(2);
+ w = scatter_data.Position(3);
+ h = scatter_data.Position(4);
-xaxis.domain = min([xo xo + w],1);
-yaxis.domain = min([yo yo + h],1);
+ xaxis.domain = min([xo xo + w],1);
+ yaxis.domain = min([yo yo + h],1);
-obj.layout = setfield(obj.layout, sprintf('xaxis%d',xsource), xaxis);
-obj.layout = setfield(obj.layout, sprintf('yaxis%d',ysource), yaxis);
+ obj.layout = setfield(obj.layout, sprintf('xaxis%d',xsource), xaxis);
+ obj.layout = setfield(obj.layout, sprintf('yaxis%d',ysource), yaxis);
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-obj.layout.annotations{1}.xref = 'paper';
-obj.layout.annotations{1}.yref = 'paper';
-obj.layout.annotations{1}.showarrow = false;
-obj.layout.annotations{1}.text = sprintf('%s', scatter_data.Title);
-obj.layout.annotations{1}.x = mean(xaxis.domain);
-obj.layout.annotations{1}.y = (yaxis.domain(2) + obj.PlotlyDefaults.TitleHeight);
-obj.layout.annotations{1}.font.color = 'rgb(0,0,0)';
-obj.layout.annotations{1}.font.size = 15;
-
+ obj.layout.annotations{1}.xref = 'paper';
+ obj.layout.annotations{1}.yref = 'paper';
+ obj.layout.annotations{1}.showarrow = false;
+ obj.layout.annotations{1}.text = sprintf('%s', scatter_data.Title);
+ obj.layout.annotations{1}.x = mean(xaxis.domain);
+ obj.layout.annotations{1}.y = (yaxis.domain(2) + obj.PlotlyDefaults.TitleHeight);
+ obj.layout.annotations{1}.font.color = 'rgb(0,0,0)';
+ obj.layout.annotations{1}.font.size = 15;
end
diff --git a/plotly/plotlyfig_aux/helpers/convertDuration.m b/plotly/plotlyfig_aux/helpers/convertDuration.m
index 380a33a7..853b2671 100644
--- a/plotly/plotlyfig_aux/helpers/convertDuration.m
+++ b/plotly/plotlyfig_aux/helpers/convertDuration.m
@@ -1,24 +1,23 @@
-function [converted,type] = convertDuration(duration)
-switch (duration.Format)
- case 's'
- converted = seconds(duration);
- type = 'sec';
- case 'm'
- converted = minutes(duration);
- type = 'min';
- case 'h'
- converted = hours(duration);
- type = 'hr';
- case 'd'
- converted = days(duration);
- type = 'days';
- case 'y'
- converted = years(duration);
- type = 'yrs';
- otherwise
- %no convertion is applied
- converted = duration;
- type = '';
-
-end
+function [converted,type] = convertDuration(duration)
+ switch (duration.Format)
+ case 's'
+ converted = seconds(duration);
+ type = 'sec';
+ case 'm'
+ converted = minutes(duration);
+ type = 'min';
+ case 'h'
+ converted = hours(duration);
+ type = 'hr';
+ case 'd'
+ converted = days(duration);
+ type = 'days';
+ case 'y'
+ converted = years(duration);
+ type = 'yrs';
+ otherwise
+ % no convertion is applied
+ converted = duration;
+ type = '';
+ end
end
\ No newline at end of file
diff --git a/plotly/plotlyfig_aux/helpers/extractAreaFace.m b/plotly/plotlyfig_aux/helpers/extractAreaFace.m
index bf2f2c0a..ec334eff 100644
--- a/plotly/plotlyfig_aux/helpers/extractAreaFace.m
+++ b/plotly/plotlyfig_aux/helpers/extractAreaFace.m
@@ -45,5 +45,4 @@
end
end
face.color = facecolor;
- %---------------------------------------------------------------------%
end
diff --git a/plotly/plotlyfig_aux/helpers/extractAreaLine.m b/plotly/plotlyfig_aux/helpers/extractAreaLine.m
index 548e95d8..007affc2 100644
--- a/plotly/plotlyfig_aux/helpers/extractAreaLine.m
+++ b/plotly/plotlyfig_aux/helpers/extractAreaLine.m
@@ -43,9 +43,6 @@
case "-."
LineStyle = "dashdot";
end
-
line.dash = LineStyle;
-
- %-----------------------------------------------------------------%
end
end
diff --git a/plotly/plotlyfig_aux/helpers/extractAxisDataMultipleYAxes.m b/plotly/plotlyfig_aux/helpers/extractAxisDataMultipleYAxes.m
index 6f3f851c..2f37d8e3 100644
--- a/plotly/plotlyfig_aux/helpers/extractAxisDataMultipleYAxes.m
+++ b/plotly/plotlyfig_aux/helpers/extractAxisDataMultipleYAxes.m
@@ -1,8 +1,7 @@
function [axis, axisLim] = extractAxisDataMultipleYAxes(obj,parentAxisData,yaxIndex)
-
childAxisData = parentAxisData.YAxis(yaxIndex);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-axis-side-%
if yaxIndex == 1
@@ -11,24 +10,16 @@
axis.side = 'right';
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-y-axis initializations-%
axis.zeroline = false;
axis.autorange = false;
axis.exponentformat = obj.PlotlyDefaults.ExponentFormat;
-
- %-------------------------------------------------------------------------%
-
- %-y-axis tick font size-%
axis.tickfont.size = childAxisData.FontSize;
-
- %-------------------------------------------------------------------------%
-
- %-y-axis tick font family-%
axis.tickfont.family = matlab2plotlyfont(childAxisData.FontName);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
ticklength = min(obj.PlotlyDefaults.MaxTickLength,...
max(childAxisData.TickLength(1)*parentAxisData.Position(3)*obj.layout.width,...
@@ -36,7 +27,7 @@
%-y-axis ticklen-%
axis.ticklen = ticklength;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-y-axis coloring-%
axiscol = sprintf('rgb(%f,%f,%f)', 255*childAxisData.Color);
@@ -51,7 +42,7 @@
axis.gridcolor = axiscol;
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-axis show grid-%
if strcmp(parentAxisData.YGrid, 'on')
@@ -60,19 +51,7 @@
axis.showgrid = false;
end
- %-------------------------------------------------------------------------%
-
- % grid = eval(['parentAxisData.' axisName 'Grid;']);
- % minorGrid = eval(['parentAxisData.' axisName 'MinorGrid;']);
-
- % if strcmp(grid, 'on') || strcmp(minorGrid, 'on')
- % %-axis show grid-%
- % axis.showgrid = true;
- % else
- % axis.showgrid = false;
- % end
-
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-line widths-%
linewidth = max(1,childAxisData.LineWidth*obj.PlotlyDefaults.AxisLineIncreaseFactor);
@@ -81,39 +60,24 @@
axis.tickwidth = linewidth;
axis.gridwidth = linewidth;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-axis type-%
axis.type = childAxisData.Scale;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-axis showtick labels / ticks-%
tickValues = childAxisData.TickValues;
if isempty(tickValues)
-
%-axis ticks-%
axis.ticks = '';
axis.showticklabels = false;
%-axis autorange-%
axis.autorange = true;
-
- %---------------------------------------------------------------------%
-
- % switch parentAxisData.Box
- % case 'on'
- % %-axis mirror-%
- % axis.mirror = true;
- % case 'off'
- % axis.mirror = false;
- % end
-
- %---------------------------------------------------------------------%
-
else
-
%-get axis limits-%
axisLim = childAxisData.Limits;
@@ -125,49 +89,24 @@
axis.ticks = 'outside';
end
- %---------------------------------------------------------------------%
- % switch parentAxisData.Box
- % case 'on'
- % %-axis mirror-%
- % axis.mirror = 'ticks';
- % case 'off'
- % axis.mirror = false;
- % end
-
%---------------------------------------------------------------------%
%-LOG TYPE-%
if strcmp(axis.type, 'log')
-
%-axis range-%
axis.range = log10(axisLim);
%-axis autotick-%
axis.autotick = true;
%-axis nticks-%
axis.nticks = length(tickValues) + 1;
-
- %---------------------------------------------------------------------%
-
- %-LINEAR TYPE-%
elseif strcmp(axis.type, 'linear')
-
- %-----------------------------------------------------------------%
-
%-get tick label mode-%
tickLabelMode = childAxisData.TickLabelsMode;
- %-----------------------------------------------------------------%
-
%-AUTO MODE-%
if strcmp(tickLabelMode, 'auto')
-
- %-------------------------------------------------------------%
-
if isnumeric(axisLim)
axis.range = axisLim;
-
- %-------------------------------------------------------------%
-
elseif isduration(axisLim)
[temp,type] = convertDuration(axisLim);
@@ -181,122 +120,53 @@
axis.range = [-delta nticks+delta];
axis.type = 'duration - specified format';
end
-
- %-------------------------------------------------------------%
-
elseif isdatetime(axisLim)
axis.range = convertDate(axisLim);
axis.type = 'date';
else
% data is a category type other then duration and datetime
end
-
%-axis autotick-%
axis.autotick = true;
%-axis numticks-%
axis.nticks = length(tickValues) + 1;
axis.showticklabels = true;
-
- %-----------------------------------------------------------------%
-
- %-CUSTOM MODE-%
- else
-
- %-------------------------------------------------------------%
-
+ else %-CUSTOM MODE-%
%-get tick labels-%
tickLabels = childAxisData.TickLabels;
- %-------------------------------------------------------------%
-
%-hide tick labels as lichkLabels field is empty-%
if isempty(tickLabels)
-
- %-------------------------------------------------------------%
-
%-hide tick labels-%
axis.showticklabels = false;
- %-------------------------------------------------------------%
-
%-axis autorange-%
axis.autorange = true;
-
- %-------------------------------------------------------------%
-
- %-axis show tick labels as tickLabels matlab field-%
- else
-
- %-------------------------------------------------------------%
-
+ else %-axis show tick labels as tickLabels matlab field-%
axis.showticklabels = true;
% axis.type = 'linear';
- %-------------------------------------------------------------%
-
if isnumeric(axisLim)
axis.range = axisLim;
else
axis.autorange = true;
end
-
- %-------------------------------------------------------------%
axis.tickvals = tickValues;
axis.ticktext = tickLabels;
-
- %-------------------------------------------------------------%
-
- %+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%
- % NOTE:
- % The next piece of code was replaced by the previous one.
- % I think that the new piece of code is better, optimal and
- % extends to all cases. However, I will leave this piece of
- % code commented in case there is a problem in the future.
- %
- % If there is a problem with the new piece of code, please
- % comment and uncomment the next piece of code.
- %
- % If everything goes well with the new gripping piece, at
- % the end of the development we will be able to remove the
- % commented lines
- %+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%
-
- %-axis labels
- % labels = str2double(tickLabels);
- % try
- % %find numbers in labels
- % labelnums = find(~isnan(labels));
- % %-axis type linear-%
- % axis.type = 'linear';
- % %-range (overwrite)-%
- % delta = (labels(labelnums(2)) - labels(labelnums(1)))/(labelnums(2)-labelnums(1));
- % axis.range = [labels(labelnums(1))-delta*(labelnums(1)-1) labels(labelnums(1)) + (length(labels)-labelnums(1))*delta];
- % %-axis autotick-%
- % axis.autotick = true;
- % %-axis numticks-%
- % axis.nticks = eval(['length(parentAxisData.' axisName 'Tick) + 1;']);
- % catch
- % %-axis type category-%
- % axis.type = 'category';
- % %-range (overwrite)-%
- % axis.autorange = true;
- % %-axis autotick-%
- % % axis.autotick = true;
- % end
end
end
end
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-scale direction-%
if strcmp(childAxisData.Direction, 'reverse')
axis.range = [axis.range(2) axis.range(1)];
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-y-axis label-%
label = childAxisData.Label;
@@ -306,7 +176,7 @@
fontunits = label.FontUnits;
set(label,'FontUnits','points');
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-title settings-%
if ~isempty(labelData.String)
@@ -317,32 +187,21 @@
axis.titlefont.size = labelData.FontSize;
axis.titlefont.family = matlab2plotlyfont(labelData.FontName);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%REVERT UNITS
set(label,'FontUnits',fontunits);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
if strcmp(childAxisData.Visible,'on')
- %-axis showline-%
axis.showline = true;
else
- %-axis showline-%
axis.showline = false;
- %-axis showticklabels-%
axis.showticklabels = false;
- %-axis ticks-%
axis.ticks = '';
- %-axis showline-%
axis.showline = false;
- %-axis showticklabels-%
axis.showticklabels = false;
- %-axis ticks-%
axis.ticks = '';
end
-
- %-------------------------------------------------------------------------%
end
-
-
diff --git a/plotly/plotlyfig_aux/helpers/extractBarMarker.m b/plotly/plotlyfig_aux/helpers/extractBarMarker.m
index 7e286e78..0c0ee564 100644
--- a/plotly/plotlyfig_aux/helpers/extractBarMarker.m
+++ b/plotly/plotlyfig_aux/helpers/extractBarMarker.m
@@ -1,89 +1,79 @@
function marker = extractBarMarker(bar_data)
-% EXTRACTS THE FACE STYLE USED FOR MATLAB OBJECTS
-% OF TYPE "bar". THESE OBJECTS ARE USED BARGRAPHS.
+ % EXTRACTS THE FACE STYLE USED FOR MATLAB OBJECTS
+ % OF TYPE "bar". THESE OBJECTS ARE USED BARGRAPHS.
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-AXIS STRUCTURE-%
-axis_data = ancestor(bar_data.Parent,'axes');
+ %-AXIS STRUCTURE-%
+ axis_data = ancestor(bar_data.Parent,'axes');
-%-FIGURE STRUCTURE-%
-figure_data = ancestor(bar_data.Parent,'figure');
+ %-FIGURE STRUCTURE-%
+ figure_data = ancestor(bar_data.Parent,'figure');
-%-INITIALIZE OUTPUT-%
-marker = struct();
+ %-INITIALIZE OUTPUT-%
+ marker = struct();
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-bar EDGE WIDTH-%
-marker.line.width = bar_data.LineWidth;
+ %-bar EDGE WIDTH-%
+ marker.line.width = bar_data.LineWidth;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-bar FACE COLOR-%
+ %-bar FACE COLOR-%
-colormap = figure_data.Colormap;
+ colormap = figure_data.Colormap;
-if isnumeric(bar_data.FaceColor)
-
- %-paper_bgcolor-%
- col = 255*bar_data.FaceColor;
- marker.color = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];
-
-else
- switch bar_data.FaceColor
-
- case 'none'
- marker.color = 'rgba(0,0,0,0,)';
-
- case 'flat'
-
- switch bar_data.CDataMapping
-
- case 'scaled'
- capCD = max(min(bar_data.FaceVertexCData(1,1),axis_data.CLim(2)),axis_data.CLim(1));
- scalefactor = (capCD -axis_data.CLim(1))/diff(axis_data.CLim);
- col = 255*(colormap(1+ floor(scalefactor*(length(colormap)-1)),:));
- case 'direct'
- col = 255*(colormap(bar_data.FaceVertexCData(1,1),:));
-
- end
-
- marker.color = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];
-
+ if isnumeric(bar_data.FaceColor)
+ %-paper_bgcolor-%
+ col = 255*bar_data.FaceColor;
+ marker.color = sprintf("rgb(%f,%f,%f)", col);
+ else
+ switch bar_data.FaceColor
+ case 'none'
+ marker.color = 'rgba(0,0,0,0,)';
+ case 'flat'
+ switch bar_data.CDataMapping
+ case 'scaled'
+ capCD = max(min(bar_data.FaceVertexCData(1,1), ...
+ axis_data.CLim(2)), axis_data.CLim(1));
+ scalefactor = (capCD - axis_data.CLim(1)) ...
+ / diff(axis_data.CLim);
+ col = 255*(colormap(1+ floor(scalefactor ...
+ * (length(colormap)-1)),:));
+ case 'direct'
+ col = 255*(colormap( ...
+ bar_data.FaceVertexCData(1,1),:));
+ end
+ marker.color = sprintf("rgb(%f,%f,%f)", col);
+ end
end
-end
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-bar EDGE COLOR-%
+ %-bar EDGE COLOR-%
-if isnumeric(bar_data.EdgeColor)
-
- col = 255*bar_data.EdgeColor;
- marker.line.color = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];
-
-else
- switch bar_data.EdgeColor
-
- case 'none'
- marker.line.color = 'rgba(0,0,0,0,)';
-
- case 'flat'
-
- switch bar_data.CDataMapping
-
- case 'scaled'
- capCD = max(min(bar_data.FaceVertexCData(1,1),axis_data.CLim(2)),axis_data.CLim(1));
- scalefactor = (capCD -axis_data.CLim(1))/diff(axis_data.CLim);
- col = 255*(colormap(1+floor(scalefactor*(length(colormap)-1)),:));
-
- case 'direct'
- col = 255*(colormap(bar_data.FaceVertexCData(1,1),:));
-
- end
-
- marker.line.color = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];
+ if isnumeric(bar_data.EdgeColor)
+ col = 255*bar_data.EdgeColor;
+ marker.line.color = sprintf("rgb(%f,%f,%f)", col);
+ else
+ switch bar_data.EdgeColor
+ case 'none'
+ marker.line.color = 'rgba(0,0,0,0,)';
+ case 'flat'
+ switch bar_data.CDataMapping
+ case 'scaled'
+ capCD = max(min(bar_data.FaceVertexCData(1,1), ...
+ axis_data.CLim(2)), axis_data.CLim(1));
+ scalefactor = (capCD - axis_data.CLim(1)) ...
+ / diff(axis_data.CLim);
+ col = 255*(colormap(1+floor(scalefactor ...
+ * (length(colormap)-1)),:));
+ case 'direct'
+ col = 255*(colormap( ...
+ bar_data.FaceVertexCData(1,1),:));
+ end
+ marker.line.color = sprintf("rgb(%f,%f,%f)", col);
+ end
end
end
-end
diff --git a/plotly/plotlyfig_aux/helpers/extractGeoLinePlusMarker.m b/plotly/plotlyfig_aux/helpers/extractGeoLinePlusMarker.m
index b6e82994..5924ecd6 100644
--- a/plotly/plotlyfig_aux/helpers/extractGeoLinePlusMarker.m
+++ b/plotly/plotlyfig_aux/helpers/extractGeoLinePlusMarker.m
@@ -1,6 +1,6 @@
function [marker, linee] = extractGeoLinePlusMarker(geoData, axisData)
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-FIGURE STRUCTURE-%
figureData = ancestor(geoData.Parent,'figure');
@@ -9,7 +9,7 @@
marker = struct();
linee = struct();
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-LINE SETTINGS-%
@@ -18,44 +18,33 @@
if isnumeric(lineColor)
lineColor = sprintf('rgb(%f,%f,%f)', 255 * lineColor);
-
else
switch lineColor
-
case 'none'
-
lineColor = 'rgba(0,0,0,0)';
-
case {'auto', 'manual'}
-
lineColor = sprintf('rgb(%f,%f,%f)', 255*lineColor);
-
case 'flat'
-
cData = geoData.CData;
cMap = figureData.Colormap;
ncolors = size(cMap, 1);
-
for m = 1:length(cData)
- colorValue = max( min( cData(m), axisData.CLim(2) ), axisData.CLim(1) );
- scaleFactor = (colorValue - axisData.CLim(1)) / diff(axisData.CLim);
- rgbColor = 255 * cMap( 1+floor(scaleFactor*(ncolors-1)), : );
+ colorValue = max(min(cData(m), axisData.CLim(2)), ...
+ axisData.CLim(1));
+ scaleFactor = (colorValue - axisData.CLim(1)) ...
+ / diff(axisData.CLim);
+ rgbColor = 255 * cMap(1+floor(scaleFactor ...
+ * (ncolors-1)),:);
lineColor{m} = sprintf('rgb(%f,%f,%f)', rgbColor);
end
-
end
end
linee.color = lineColor;
-
- % line width
linee.width = 2*geoData.LineWidth;
-
- % line style
lineStyle = geoData.LineStyle;
switch lineStyle
-
case '-'
lineStyle = 'solid';
case '--'
@@ -68,26 +57,16 @@
linee.dash = lineStyle;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
- %-MARKER SIZEREF-%
marker.sizeref = 1;
-
- %-------------------------------------------------------------------------%
-
- %-MARKER SIZEMODE-%
marker.sizemode = 'area';
-
- %-------------------------------------------------------------------------%
-
- %-MARKER SIZE (STYLE)-%
marker.size = geoData.MarkerSize;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-MARKER SYMBOL (STYLE)-%
- if ~strcmp(geoData.Marker,'none')
-
+ if ~strcmp(geoData.Marker, 'none')
switch geoData.Marker
case '.'
marksymbol = 'circle';
@@ -120,65 +99,55 @@
marker.symbol = marksymbol;
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-MARKER LINE WIDTH (STYLE)-%
marker.line.width = 2*geoData.LineWidth;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%--MARKER FILL COLOR--%
% marker face color
faceColor = geoData.MarkerFaceColor;
- filledMarkerSet = {'o','square','s','diamond','d','v','^', '<','>','hexagram','pentagram'};
+ filledMarkerSet = {'o','square','s','diamond','d','v','^', '<', ...
+ '>','hexagram','pentagram'};
filledMarker = ismember(geoData.Marker, filledMarkerSet);
if filledMarker
-
if isnumeric(faceColor)
markerColor = sprintf('rgb(%f,%f,%f)', 255 * faceColor);
-
else
-
switch faceColor
-
case 'none'
-
markerColor = 'rgba(0,0,0,0)';
-
case 'auto'
-
if ~strcmp(axisData.Color,'none')
col = 255*axisData.Color;
else
col = 255*figureData.Color;
end
-
markerColor = sprintf('rgb(%f,%f,%f)', col);
-
case 'flat'
-
cData = geoData.CData;
cMap = figureData.Colormap;
ncolors = size(cMap, 1);
-
for m = 1:length(cData)
- colorValue = max( min( cData(m), axisData.CLim(2) ), axisData.CLim(1) );
- scaleFactor = (colorValue - axisData.CLim(1)) / diff(axisData.CLim);
- rgbColor = 255 * cMap( 1+floor(scaleFactor*(ncolors-1)), : );
+ colorValue = max(min(cData(m), ...
+ axisData.CLim(2)), axisData.CLim(1));
+ scaleFactor = (colorValue - axisData.CLim(1)) ...
+ / diff(axisData.CLim);
+ rgbColor = 255 * cMap(1+floor(scaleFactor ...
+ * (ncolors-1)),:);
markerColor{m} = sprintf('rgb(%f,%f,%f)', rgbColor);
end
end
end
-
- %-set marker color-%
marker.color = markerColor;
-
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-MARKER LINE COLOR-%
@@ -187,31 +156,25 @@
if isnumeric(edgeColor)
lineColor = sprintf('rgb(%f,%f,%f)', 255 * edgeColor);
-
else
switch edgeColor
-
case 'none'
-
lineColor = 'rgba(0,0,0,0)';
-
case 'auto'
-
lineColor = sprintf('rgb(%f,%f,%f)', 255*geoData.Color);
-
case 'flat'
-
cData = geoData.CData;
cMap = figureData.Colormap;
ncolors = size(cMap, 1);
-
for m = 1:length(cData)
- colorValue = max( min( cData(m), axisData.CLim(2) ), axisData.CLim(1) );
- scaleFactor = (colorValue - axisData.CLim(1)) / diff(axisData.CLim);
- rgbColor = 255 * cMap( 1+floor(scaleFactor*(ncolors-1)), : );
+ colorValue = max(min(cData(m), axisData.CLim(2)), ...
+ axisData.CLim(1));
+ scaleFactor = (colorValue - axisData.CLim(1)) ...
+ / diff(axisData.CLim);
+ rgbColor = 255 * cMap(1+floor(scaleFactor ...
+ * (ncolors-1)),:);
lineColor{m} = sprintf('rgb(%f,%f,%f)', rgbColor);
end
-
end
end
@@ -220,7 +183,4 @@
else
marker.color = lineColor;
end
-
- %-------------------------------------------------------------------------%
-
end
diff --git a/plotly/plotlyfig_aux/helpers/extractGeoMarker.m b/plotly/plotlyfig_aux/helpers/extractGeoMarker.m
index 10025960..dd2a2705 100644
--- a/plotly/plotlyfig_aux/helpers/extractGeoMarker.m
+++ b/plotly/plotlyfig_aux/helpers/extractGeoMarker.m
@@ -1,33 +1,20 @@
function marker = extractGeoMarker(geoData, axisData)
-
- %-------------------------------------------------------------------------%
-
%-FIGURE STRUCTURE-%
figureData = ancestor(geoData.Parent,'figure');
%-INITIALIZE OUTPUT-%
marker = struct();
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
- %-MARKER SIZEREF-%
marker.sizeref = 1;
-
- %-------------------------------------------------------------------------%
-
- %-MARKER SIZEMODE-%
marker.sizemode = 'area';
-
- %-------------------------------------------------------------------------%
-
- %-MARKER SIZE (STYLE)-%
marker.size = geoData.SizeData;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-MARKER SYMBOL (STYLE)-%
- if ~strcmp(geoData.Marker,'none')
-
+ if ~strcmp(geoData.Marker, 'none')
switch geoData.Marker
case '.'
marksymbol = 'circle';
@@ -60,65 +47,55 @@
marker.symbol = marksymbol;
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-MARKER LINE WIDTH (STYLE)-%
marker.line.width = 2*geoData.LineWidth;
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%--MARKER FILL COLOR--%
% marker face color
faceColor = geoData.MarkerFaceColor;
- filledMarkerSet = {'o','square','s','diamond','d','v','^', '<','>','hexagram','pentagram'};
+ filledMarkerSet = {'o','square','s','diamond','d','v','^', '<', ...
+ '>','hexagram','pentagram'};
filledMarker = ismember(geoData.Marker, filledMarkerSet);
if filledMarker
-
if isnumeric(faceColor)
markerColor = sprintf('rgb(%f,%f,%f)', 255 * faceColor);
-
else
-
switch faceColor
-
case 'none'
-
markerColor = 'rgba(0,0,0,0)';
-
case 'auto'
-
- if ~strcmp(axisData.Color,'none')
+ if ~strcmp(axisData.Color, 'none')
col = 255*axisData.Color;
else
col = 255*figureData.Color;
end
-
markerColor = sprintf('rgb(%f,%f,%f)', col);
-
case 'flat'
-
cData = geoData.CData;
cMap = figureData.Colormap;
ncolors = size(cMap, 1);
-
for m = 1:length(cData)
- colorValue = max( min( cData(m), axisData.CLim(2) ), axisData.CLim(1) );
- scaleFactor = (colorValue - axisData.CLim(1)) / diff(axisData.CLim);
- rgbColor = 255 * cMap( 1+floor(scaleFactor*(ncolors-1)), : );
+ colorValue = max(min(cData(m), ...
+ axisData.CLim(2)), axisData.CLim(1));
+ scaleFactor = (colorValue - axisData.CLim(1)) ...
+ / diff(axisData.CLim);
+ rgbColor = 255 * cMap(1+floor(scaleFactor ...
+ * (ncolors-1)),:);
markerColor{m} = sprintf('rgb(%f,%f,%f)', rgbColor);
end
end
end
-
- %-set marker color-%
marker.color = markerColor;
-
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-MARKER LINE COLOR-%
@@ -127,31 +104,25 @@
if isnumeric(edgeColor)
lineColor = sprintf('rgb(%f,%f,%f)', 255 * edgeColor);
-
else
switch edgeColor
-
case 'none'
-
lineColor = 'rgba(0,0,0,0)';
-
case 'auto'
-
% TODO
-
case 'flat'
-
cData = geoData.CData;
cMap = figureData.Colormap;
ncolors = size(cMap, 1);
-
for m = 1:length(cData)
- colorValue = max( min( cData(m), axisData.CLim(2) ), axisData.CLim(1) );
- scaleFactor = (colorValue - axisData.CLim(1)) / diff(axisData.CLim);
- rgbColor = 255 * cMap( 1+floor(scaleFactor*(ncolors-1)), : );
+ colorValue = max(min(cData(m), axisData.CLim(2)), ...
+ axisData.CLim(1));
+ scaleFactor = (colorValue - axisData.CLim(1)) ...
+ / diff(axisData.CLim);
+ rgbColor = 255 * cMap(1+floor(scaleFactor ...
+ * (ncolors-1)),:);
lineColor{m} = sprintf('rgb(%f,%f,%f)', rgbColor);
end
-
end
end
@@ -160,7 +131,4 @@
else
marker.color = lineColor;
end
-
- %-------------------------------------------------------------------------%
-
end
diff --git a/plotly/plotlyfig_aux/helpers/extractHeatmapAxisData.m b/plotly/plotlyfig_aux/helpers/extractHeatmapAxisData.m
index 5e09c149..87382bce 100644
--- a/plotly/plotlyfig_aux/helpers/extractHeatmapAxisData.m
+++ b/plotly/plotlyfig_aux/helpers/extractHeatmapAxisData.m
@@ -1,141 +1,85 @@
function [axis] = extractHeatmapAxisData(obj,axis_data,axisName)
-%extract information related to each axis
-% axis_data is the data extrated from the figure, axisName take the
-% values 'x' 'y' or 'z'
+ %extract information related to each axis
+ % axis_data is the data extrated from the figure, axisName take the
+ % values 'x' 'y' or 'z'
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ axis.zeroline = false;
+ axis.autorange = false;
+ axis.exponentformat = obj.PlotlyDefaults.ExponentFormat;
+ axis.tickfont.size = axis_data.FontSize;
+ axis.tickfont.family = matlab2plotlyfont(axis_data.FontName);
-%-axis-side-%
-% axis.side = eval(['axis_data.' axisName 'AxisLocation;']);
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ tl = axis_data.(axisName + "Data");
+ tl = length(tl);
-%-axis zeroline-%
-axis.zeroline = false;
+ w = axis_data.Position(4);
+ h = axis_data.Position(3);
-%-------------------------------------------------------------------------%
+ ticklength = min(obj.PlotlyDefaults.MaxTickLength,...
+ max(tl*w*obj.layout.width,tl*h*obj.layout.height));
-%-axis autorange-%
-axis.autorange = false;
+ axis.ticklen = 0.1; %ticklength;
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-%-axis exponent format-%
-axis.exponentformat = obj.PlotlyDefaults.ExponentFormat;
+ axiscol = 'rgb(150, 150, 150)';
-%-------------------------------------------------------------------------%
+ axis.linecolor = axiscol;
+ axis.tickcolor = axiscol;
+ axis.tickfont.color = 'black';
+ axis.gridcolor = 'rgb(0, 0, 0)';
-%-axis tick font size-%
-axis.tickfont.size = axis_data.FontSize;
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ axis.showgrid = true;
-%-axis tick font family-%
-axis.tickfont.family = matlab2plotlyfont(axis_data.FontName);
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ lw = 0.5;
+ linewidth = max(1,lw*obj.PlotlyDefaults.AxisLineIncreaseFactor);
-tl = axis_data.(axisName + "Data");
-tl = length(tl);
+ axis.linewidth = linewidth;
+ axis.tickwidth = linewidth;
+ axis.gridwidth = linewidth*1.2;
-w = axis_data.Position(4);
-h = axis_data.Position(3);
+ %---------------------------------------------------------------------%
-ticklength = min(obj.PlotlyDefaults.MaxTickLength,...
- max(tl*w*obj.layout.width,tl*h*obj.layout.height));
+ %-setting ticks-%
+ axis.ticks = 'inside';
+ axis.mirror = true;
-%-axis ticklen-%
-axis.ticklen = 0.1; %ticklength;
+ labels = axis_data.(axisName + "DisplayLabels");
+ vals = axis_data.(axisName + "DisplayData");
-%-------------------------------------------------------------------------%
+ axis.showticklabels = true;
+ axis.type = 'category';
+ axis.autorange = true;
+ axis.ticktext = labels;
+ axis.tickvals = vals;
+ axis.autotick = false;
+ axis.tickson = 'boundaries';
-% col = eval(['255*axis_data.' axisName 'Color;']);
-axiscol = 'rgb(150, 150, 150)';
+ %-------------------------------LABELS--------------------------------%
-%-axis linecolor-%
-axis.linecolor = axiscol;
-%-axis tickcolor-%
-axis.tickcolor = axiscol;
-%-axis tickfont-%
-axis.tickfont.color = 'black';
-%-axis grid color-%
-axis.gridcolor = 'rgb(0, 0, 0)';
+ label = axis_data.(axisName + "Label");
+ axis.title = label;
+ axis.titlefont.color = 'black';
+ axis.titlefont.size = axis_data.FontSize*1.3;
+ axis.tickfont.size = axis_data.FontSize*1.15;
+ axis.titlefont.family = matlab2plotlyfont(axis_data.FontName);
+ axis.tickfont.family = matlab2plotlyfont(axis_data.FontName);
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
-axis.showgrid = true;
-
-%-------------------------------------------------------------------------%
-
-lw = 0.5;
-linewidth = max(1,lw*obj.PlotlyDefaults.AxisLineIncreaseFactor);
-
-%-axis line width-%
-axis.linewidth = linewidth;
-%-axis tick width-%
-axis.tickwidth = linewidth;
-%-axis grid width-%
-axis.gridwidth = linewidth*1.2;
-
-%-------------------------------------------------------------------------%
-
-%-setting ticks-%
-axis.ticks = 'inside';
-axis.mirror = true;
-
-labels = axis_data.(axisName + "DisplayLabels");
-vals = axis_data.(axisName + "DisplayData");
-
-axis.showticklabels = true;
-axis.type = 'category';
-axis.autorange = true;
-axis.ticktext = labels;
-axis.tickvals = vals;
-axis.autotick = false;
-axis.tickson = 'boundaries';
-
-%-------------------------------LABELS------------------------------------%
-
-label = axis_data.(axisName + "Label");
-
-%-------------------------------------------------------------------------%
-
-%-title-%
-axis.title = label;
-
-%-------------------------------------------------------------------------%
-
-%-axis title font color-%
-axis.titlefont.color = 'black';
-
-%-------------------------------------------------------------------------%
-
-%-axis title font size-%
-axis.titlefont.size = axis_data.FontSize*1.3;
-axis.tickfont.size = axis_data.FontSize*1.15;
-
-%-------------------------------------------------------------------------%
-
-%-axis title font family-%
-axis.titlefont.family = matlab2plotlyfont(axis_data.FontName);
-axis.tickfont.family = matlab2plotlyfont(axis_data.FontName);
-
-%-------------------------------------------------------------------------%
-
-if strcmp(axis_data.Visible,'on')
- %-axis showline-%
- axis.showline = true;
-else
- %-axis showline-%
- axis.showline = false;
- %-axis showticklabels-%
- axis.showticklabels = false;
- %-axis ticks-%
- axis.ticks = '';
-end
-
-%-------------------------------------------------------------------------%
+ if strcmp(axis_data.Visible,'on')
+ axis.showline = true;
+ else
+ axis.showline = false;
+ axis.showticklabels = false;
+ axis.ticks = '';
+ end
end
-
-
diff --git a/plotly/plotlyfig_aux/helpers/extractLineLine.m b/plotly/plotlyfig_aux/helpers/extractLineLine.m
index 1b052329..e2e56c87 100644
--- a/plotly/plotlyfig_aux/helpers/extractLineLine.m
+++ b/plotly/plotlyfig_aux/helpers/extractLineLine.m
@@ -1,44 +1,30 @@
function line = extractLineLine(line_data)
+ % EXTRACTS THE LINE STYLE USED FOR MATLAB OBJECTS
+ % OF TYPE "LINE". THESE OBJECTS ARE USED IN LINESERIES,
+ % STAIRSERIES, STEMSERIES, BASELINESERIES, AND BOXPLOTS
-% EXTRACTS THE LINE STYLE USED FOR MATLAB OBJECTS
-% OF TYPE "LINE". THESE OBJECTS ARE USED IN LINESERIES,
-% STAIRSERIES, STEMSERIES, BASELINESERIES, AND BOXPLOTS
+ %-INITIALIZE OUTPUT-%
+ line = struct();
-%-------------------------------------------------------------------------%
+ if (~strcmp(line_data.LineStyle, 'none'))
+ %-SCATTER LINE COLOR (STYLE)-%
+ col = 255*line_data.Color;
+ line.color = sprintf("rgb(%f,%f,%f)", col);
-%-INITIALIZE OUTPUT-%
-line = struct();
+ %-SCATTER LINE WIDTH (STYLE)-%
+ line.width = line_data.LineWidth;
-%-------------------------------------------------------------------------%
-
-if(~strcmp(line_data.LineStyle,'none'))
-
- %-SCATTER LINE COLOR (STYLE)-%
- col = 255*line_data.Color;
- line.color = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];
-
- %---------------------------------------------------------------------%
-
- %-SCATTER LINE WIDTH (STYLE)-%
- line.width = line_data.LineWidth;
-
- %---------------------------------------------------------------------%
-
- %-SCATTER LINE DASH (STYLE)-%
- switch line_data.LineStyle
- case '-'
- LineStyle = 'solid';
- case '--'
- LineStyle = 'dash';
- case ':'
- LineStyle = 'dot';
- case '-.'
- LineStyle = 'dashdot';
+ %-SCATTER LINE DASH (STYLE)-%
+ switch line_data.LineStyle
+ case '-'
+ LineStyle = 'solid';
+ case '--'
+ LineStyle = 'dash';
+ case ':'
+ LineStyle = 'dot';
+ case '-.'
+ LineStyle = 'dashdot';
+ end
+ line.dash = LineStyle;
end
-
- line.dash = LineStyle;
-
- %---------------------------------------------------------------------%
-
-end
end
\ No newline at end of file
diff --git a/plotly/plotlyfig_aux/helpers/extractLineMarker.m b/plotly/plotlyfig_aux/helpers/extractLineMarker.m
index 6c53f35f..bae66c0f 100644
--- a/plotly/plotlyfig_aux/helpers/extractLineMarker.m
+++ b/plotly/plotlyfig_aux/helpers/extractLineMarker.m
@@ -22,7 +22,7 @@
%---------------------------------------------------------------------%
%-MARKER SYMBOL-%
- if ~strcmp(line_data.Marker,"none")
+ if ~strcmp(line_data.Marker, "none")
switch line_data.Marker
case "."
marksymbol = "circle";
diff --git a/plotly/plotlyfig_aux/helpers/extractPatchFace.m b/plotly/plotlyfig_aux/helpers/extractPatchFace.m
index 1d159a8f..e519e6fb 100644
--- a/plotly/plotlyfig_aux/helpers/extractPatchFace.m
+++ b/plotly/plotlyfig_aux/helpers/extractPatchFace.m
@@ -36,10 +36,10 @@
switch patch_data.CDataMapping
case "scaled"
capCD = max(min(patch_data.FaceVertexCData(1,1), ...
- axis_data.CLim(2)),axis_data.CLim(1));
- scalefactor = (capCD -axis_data.CLim(1)) ...
+ axis_data.CLim(2)), axis_data.CLim(1));
+ scalefactor = (capCD - axis_data.CLim(1)) ...
/ diff(axis_data.CLim);
- col = 255*(colormap(1+ floor(scalefactor ...
+ col = 255*(colormap(1 + floor(scalefactor ...
* (length(colormap)-1)),:));
case "direct"
col = 255*(colormap(patch_data.FaceVertexCData(1,1),:));
@@ -73,7 +73,8 @@
col = 255*(colormap(1+floor(scalefactor ...
* (length(colormap)-1)),:));
case "direct"
- col = 255*(colormap(patch_data.FaceVertexCData(1,1),:));
+ col = 255*(colormap( ...
+ patch_data.FaceVertexCData(1,1),:));
end
col = [col patch_data.EdgeAlpha];
end
diff --git a/plotly/plotlyfig_aux/helpers/extractPatchLine.m b/plotly/plotlyfig_aux/helpers/extractPatchLine.m
index 3b858b9f..4037696f 100644
--- a/plotly/plotlyfig_aux/helpers/extractPatchLine.m
+++ b/plotly/plotlyfig_aux/helpers/extractPatchLine.m
@@ -1,79 +1,65 @@
function line = extractPatchLine(patch_data)
+ % EXTRACTS THE LINE STYLE USED FOR MATLAB OBJECTS
+ % OF TYPE "LINE". THESE OBJECTS ARE USED IN LINESERIES,
+ % STAIRSERIES, STEMSERIES, BASELINESERIES, AND BOXPLOTS
-% EXTRACTS THE LINE STYLE USED FOR MATLAB OBJECTS
-% OF TYPE "LINE". THESE OBJECTS ARE USED IN LINESERIES,
-% STAIRSERIES, STEMSERIES, BASELINESERIES, AND BOXPLOTS
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-AXIS STRUCTURE-%
+ axis_data = ancestor(patch_data.Parent,'axes');
-%-AXIS STRUCTURE-%
-axis_data = ancestor(patch_data.Parent,'axes');
+ %-FIGURE STRUCTURE-%
+ figure_data = ancestor(patch_data.Parent,'figure');
-%-FIGURE STRUCTURE-%
-figure_data = ancestor(patch_data.Parent,'figure');
+ %-INITIALIZE OUTPUT-%
+ line = struct();
-%-INITIALIZE OUTPUT-%
-line = struct();
+ %---------------------------------------------------------------------%
-%-------------------------------------------------------------------------%
+ %-PATCH LINE COLOR-%
-%-PATCH LINE COLOR-%
+ colormap = figure_data.Colormap;
-colormap = figure_data.Colormap;
+ if (~strcmp(patch_data.LineStyle,'none'))
+ if isnumeric(patch_data.EdgeColor)
+ col = 255*patch_data.EdgeColor;
+ line.color = sprintf("rgb(%f,%f,%f)", col);
+ else
+ switch patch_data.EdgeColor
+ case 'none'
+ line.color = 'rgba(0,0,0,0,)';
+ case 'flat'
+ switch patch_data.CDataMapping
+ case 'scaled'
+ capCD = max(min( ...
+ patch_data.FaceVertexCData(1,1), ...
+ axis_data.CLim(2)), axis_data.CLim(1));
+ scalefactor = (capCD - axis_data.CLim(1)) ...
+ / diff(axis_data.CLim);
+ col = 255*(colormap(1+floor(scalefactor ...
+ * (length(colormap)-1)),:));
+ case 'direct'
+ col = 255*(colormap( ...
+ patch_data.FaceVertexCData(1,1),:));
+ end
+ line.color = sprintf("rgb(%f,%f,%f)", col);
+ end
+ end
-if(~strcmp(patch_data.LineStyle,'none'))
-
- if isnumeric(patch_data.EdgeColor)
-
- col = 255*patch_data.EdgeColor;
- line.color = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];
-
- else
- switch patch_data.EdgeColor
-
- case 'none'
- line.color = 'rgba(0,0,0,0,)';
-
- case 'flat'
-
- switch patch_data.CDataMapping
-
- case 'scaled'
- capCD = max(min(patch_data.FaceVertexCData(1,1),axis_data.CLim(2)),axis_data.CLim(1));
- scalefactor = (capCD -axis_data.CLim(1))/diff(axis_data.CLim);
- col = 255*(colormap(1+floor(scalefactor*(length(colormap)-1)),:));
-
- case 'direct'
- col = 255*(colormap(patch_data.FaceVertexCData(1,1),:));
-
- end
-
- line.color = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];
+ %-PATCH LINE WIDTH (STYLE)-%
+ line.width = patch_data.LineWidth;
+
+ %-PATCH LINE DASH (STYLE)-%
+ switch patch_data.LineStyle
+ case '-'
+ LineStyle = 'solid';
+ case '--'
+ LineStyle = 'dash';
+ case ':'
+ LineStyle = 'dot';
+ case '-.'
+ LineStyle = 'dashdot';
end
+ line.dash = LineStyle;
end
-
- %---------------------------------------------------------------------%
-
- %-PATCH LINE WIDTH (STYLE)-%
- line.width = patch_data.LineWidth;
-
- %---------------------------------------------------------------------%
-
- %-PATCH LINE DASH (STYLE)-%
- switch patch_data.LineStyle
- case '-'
- LineStyle = 'solid';
- case '--'
- LineStyle = 'dash';
- case ':'
- LineStyle = 'dot';
- case '-.'
- LineStyle = 'dashdot';
- end
-
- line.dash = LineStyle;
-
- %---------------------------------------------------------------------%
-
-end
end
diff --git a/plotly/plotlyfig_aux/helpers/extractPatchMarker.m b/plotly/plotlyfig_aux/helpers/extractPatchMarker.m
index e1fddcbe..18cbcfe9 100644
--- a/plotly/plotlyfig_aux/helpers/extractPatchMarker.m
+++ b/plotly/plotlyfig_aux/helpers/extractPatchMarker.m
@@ -1,230 +1,197 @@
function marker = extractPatchMarker(patch_data)
-
-% EXTRACTS THE MARKER STYLE USED FOR MATLAB OBJECTS
-% OF TYPE "PATCH". THESE OBJECTS ARE USED IN AREASERIES
-% BARSERIES, CONTOURGROUP, SCATTERGROUP.
-
-%-------------------------------------------------------------------------%
-
-%-AXIS STRUCTURE-%
-axis_data = ancestor(patch_data.Parent,'axes');
-
-%-FIGURE STRUCTURE-%
-figure_data = ancestor(patch_data.Parent,'figure');
-
-%-INITIALIZE OUTPUT-%
-marker = struct();
-
-%-------------------------------------------------------------------------%
-
-%-MARKER SIZEREF-%
-marker.sizeref = 1;
-
-%-------------------------------------------------------------------------%
-
-%-MARKER SIZEMODE-%
-marker.sizemode = 'diameter';
-
-%-------------------------------------------------------------------------%
-
-%-MARKER SIZE (STYLE)-%
-marker.size = patch_data.MarkerSize;
-
-%-------------------------------------------------------------------------%
-
-%-MARKER SYMBOL (STYLE)-%
-if ~strcmp(patch_data.Marker,'none')
-
- switch patch_data.Marker
- case '.'
- marksymbol = 'circle';
- case 'o'
- marksymbol = 'circle';
- case 'x'
- marksymbol = 'x-thin-open';
- case '+'
- marksymbol = 'cross-thin-open';
- case '*'
- marksymbol = 'asterisk-open';
- case {'s','square'}
- marksymbol = 'square';
- case {'d','diamond'}
- marksymbol = 'diamond';
- case 'v'
- marksymbol = 'triangle-down';
- case '^'
- marksymbol = 'triangle-up';
- case '<'
- marksymbol = 'triangle-left';
- case '>'
- marksymbol = 'triangle-right';
- case {'p','pentagram'}
- marksymbol = 'star';
- case {'h','hexagram'}
- marksymbol = 'hexagram';
+ % EXTRACTS THE MARKER STYLE USED FOR MATLAB OBJECTS
+ % OF TYPE "PATCH". THESE OBJECTS ARE USED IN AREASERIES
+ % BARSERIES, CONTOURGROUP, SCATTERGROUP.
+
+ %---------------------------------------------------------------------%
+
+ %-AXIS STRUCTURE-%
+ axis_data = ancestor(patch_data.Parent, 'axes');
+
+ %-FIGURE STRUCTURE-%
+ figure_data = ancestor(patch_data.Parent, 'figure');
+
+ %-INITIALIZE OUTPUT-%
+ marker = struct();
+
+ %---------------------------------------------------------------------%
+
+ marker.sizeref = 1;
+ marker.sizemode = 'diameter';
+ marker.size = patch_data.MarkerSize;
+
+ %---------------------------------------------------------------------%
+
+ %-MARKER SYMBOL (STYLE)-%
+ if ~strcmp(patch_data.Marker, 'none')
+ switch patch_data.Marker
+ case '.'
+ marksymbol = 'circle';
+ case 'o'
+ marksymbol = 'circle';
+ case 'x'
+ marksymbol = 'x-thin-open';
+ case '+'
+ marksymbol = 'cross-thin-open';
+ case '*'
+ marksymbol = 'asterisk-open';
+ case {'s','square'}
+ marksymbol = 'square';
+ case {'d','diamond'}
+ marksymbol = 'diamond';
+ case 'v'
+ marksymbol = 'triangle-down';
+ case '^'
+ marksymbol = 'triangle-up';
+ case '<'
+ marksymbol = 'triangle-left';
+ case '>'
+ marksymbol = 'triangle-right';
+ case {'p','pentagram'}
+ marksymbol = 'star';
+ case {'h','hexagram'}
+ marksymbol = 'hexagram';
+ end
+ marker.symbol = marksymbol;
end
-
- marker.symbol = marksymbol;
-end
-%-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
+
+ %-MARKER LINE WIDTH (STYLE)-%
+ marker.line.width = patch_data.LineWidth;
+
+ %---------------------------------------------------------------------%
+
+ %--MARKER FILL COLOR--%
+
+ %-figure colormap-%
+ colormap = figure_data.Colormap;
+
+ % marker face color
+ MarkerColor = patch_data.MarkerFaceColor;
-%-MARKER LINE WIDTH (STYLE)-%
-marker.line.width = patch_data.LineWidth;
+ filledMarkerSet = {'o','square','s','diamond','d',...
+ 'v','^', '<','>','hexagram','pentagram'};
-%-------------------------------------------------------------------------%
+ filledMarker = ismember(patch_data.Marker, filledMarkerSet);
-%--MARKER FILL COLOR--%
+ % initialize markercolor output
+ markercolor = cell(1, length(patch_data.FaceVertexCData));
-%-figure colormap-%
-colormap = figure_data.Colormap;
+ if filledMarker
+ if isnumeric(MarkerColor)
+ col = 255*MarkerColor;
+ markercolor = sprintf("rgb(%f,%f,%f)", col);
+ else
+ switch MarkerColor
+ case 'none'
+ markercolor = 'rgba(0,0,0,0)';
+ case 'auto'
+ if ~strcmp(axis_data.Color,'none')
+ col = 255*axis_data.Color;
+ else
+ col = 255*figure_data.Color;
+ end
+ markercolor = sprintf("rgb(%f,%f,%f)", col);
+ case 'flat'
+ for n = 1:length(patch_data.FaceVertexCData)
+ switch patch_data.CDataMapping
+ case 'scaled'
+ capCD = max(min( ...
+ patch_data.FaceVertexCData(n,1), ...
+ axis_data.CLim(2)), ...
+ axis_data.CLim(1));
+ scalefactor = (capCD - axis_data.CLim(1)) ...
+ / diff(axis_data.CLim);
+ col = 255*(colormap(1 + ...
+ floor(scalefactor ...
+ * (length(colormap)-1)),:));
+ case 'direct'
+ col = 255*(colormap( ...
+ patch_data.FaceVertexCData(n,1),:));
+ end
+ markercolor{n} = sprintf("rgb(%f,%f,%f)", col);
+ end
+ end
+ end
+ marker.color = markercolor;
+ end
-% marker face color
-MarkerColor = patch_data.MarkerFaceColor;
+ %---------------------------------------------------------------------%
-filledMarkerSet = {'o','square','s','diamond','d',...
- 'v','^', '<','>','hexagram','pentagram'};
+ %-MARKER LINE COLOR-%
-filledMarker = ismember(patch_data.Marker,filledMarkerSet);
+ % marker edge color
+ MarkerLineColor = patch_data.MarkerEdgeColor;
-% initialize markercolor output
-markercolor = cell(1,length(patch_data.FaceVertexCData));
+ filledMarker = ismember(patch_data.Marker,filledMarkerSet);
-if filledMarker
-
- if isnumeric(MarkerColor)
- col = 255*MarkerColor;
- markercolor = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];
+ % initialize marker line color
+ markerlinecolor = cell(1,length(patch_data.FaceVertexCData));
+
+ if isnumeric(MarkerLineColor)
+ col = 255*MarkerLineColor;
+ markerlinecolor = sprintf("rgb(%f,%f,%f)", col);
else
- switch MarkerColor
-
+ switch MarkerLineColor
case 'none'
-
- markercolor = 'rgba(0,0,0,0)';
-
+ markerlinecolor = 'rgba(0,0,0,0)';
case 'auto'
-
- if ~strcmp(axis_data.Color,'none')
- col = 255*axis_data.Color;
+ EdgeColor = patch_data.EdgeColor;
+ if isnumeric(EdgeColor)
+ col = 255*EdgeColor;
+ markerlinecolor = sprintf("rgb(%f,%f,%f)", col);
else
- col = 255*figure_data.Color;
+ switch EdgeColor
+ case 'none'
+ markerlinecolor = 'rgba(0,0,0,0)';
+ case {'flat', 'interp'}
+ for n = 1:length(patch_data.FaceVertexCData)
+ switch patch_data.CDataMapping
+ case 'scaled'
+ capCD = max(min( ...
+ patch_data.FaceVertexCData(n,1), ...
+ axis_data.CLim(2)), ...
+ axis_data.CLim(1));
+ scalefactor = (capCD ...
+ - axis_data.CLim(1)) ...
+ / diff(axis_data.CLim);
+ col = 255*(colormap(1 + ...
+ floor(scalefactor ...
+ * (length(colormap)-1)),:));
+ case 'direct'
+ col = 255*(colormap( ...
+ patch_data.FaceVertexCData(n,1),:));
+ end
+ markerlinecolor{n} = ...
+ sprintf("rgb(%f,%f,%f)", col);
+ end
+ end
end
-
- markercolor = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];
-
-
case 'flat'
-
for n = 1:length(patch_data.FaceVertexCData)
-
switch patch_data.CDataMapping
-
case 'scaled'
- capCD = max(min(patch_data.FaceVertexCData(n,1),axis_data.CLim(2)),axis_data.CLim(1));
- scalefactor = (capCD - axis_data.CLim(1))/diff(axis_data.CLim);
- col = 255*(colormap(1 + floor(scalefactor*(length(colormap)-1)),:));
+ capCD = max(min( ...
+ patch_data.FaceVertexCData(n,1), ...
+ axis_data.CLim(2)), ...
+ axis_data.CLim(1));
+ scalefactor = (capCD - axis_data.CLim(1)) ...
+ / diff(axis_data.CLim);
+ col = 255*(colormap(1+floor(scalefactor ...
+ * (length(colormap)-1)),:));
case 'direct'
- col = 255*(colormap(patch_data.FaceVertexCData(n,1),:));
+ col = 255*(colormap( ...
+ patch_data.FaceVertexCData(n,1),:));
end
-
- markercolor{n} = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];
-
+ markerlinecolor{n} = sprintf("rgb(%f,%f,%f)", col);
end
end
end
-
- marker.color = markercolor;
-
-end
-
-%-------------------------------------------------------------------------%
-
-%-MARKER LINE COLOR-%
-
-% marker edge color
-MarkerLineColor = patch_data.MarkerEdgeColor;
-
-filledMarker = ismember(patch_data.Marker,filledMarkerSet);
-
-% initialize marker line color
-markerlinecolor = cell(1,length(patch_data.FaceVertexCData));
-
-if isnumeric(MarkerLineColor)
- col = 255*MarkerLineColor;
- markerlinecolor = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];
-else
- switch MarkerLineColor
-
- case 'none'
-
- markerlinecolor = 'rgba(0,0,0,0)';
-
- case 'auto'
-
- EdgeColor = patch_data.EdgeColor;
-
- if isnumeric(EdgeColor)
- col = 255*EdgeColor;
- markerlinecolor = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];
- else
-
- switch EdgeColor
-
- case 'none'
-
- markerlinecolor = 'rgba(0,0,0,0)';
-
- case {'flat', 'interp'}
-
- for n = 1:length(patch_data.FaceVertexCData)
-
- switch patch_data.CDataMapping
-
- case 'scaled'
- capCD = max(min(patch_data.FaceVertexCData(n,1),axis_data.CLim(2)),axis_data.CLim(1));
- scalefactor = (capCD - axis_data.CLim(1))/diff(axis_data.CLim);
- col = 255*(colormap(1 + floor(scalefactor*(length(colormap)-1)),:));
-
- case 'direct'
- col = 255*(colormap(patch_data.FaceVertexCData(n,1),:));
-
- end
-
- markerlinecolor{n} = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];
-
- end
-
- end
- end
-
- case 'flat'
-
- for n = 1:length(patch_data.FaceVertexCData)
-
- switch patch_data.CDataMapping
-
- case 'scaled'
- capCD = max(min(patch_data.FaceVertexCData(n,1),axis_data.CLim(2)),axis_data.CLim(1));
- scalefactor = (capCD - axis_data.CLim(1))/diff(axis_data.CLim);
- col = 255*(colormap(1+floor(scalefactor*(length(colormap)-1)),:));
- case 'direct'
- col = 255*(colormap(patch_data.FaceVertexCData(n,1),:));
-
- end
-
- markerlinecolor{n} = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];
-
- end
+ if filledMarker
+ marker.line.color = markerlinecolor;
+ else
+ marker.color = markerlinecolor;
end
end
-
-if filledMarker
- marker.line.color = markerlinecolor;
-else
- marker.color = markerlinecolor;
-end
-
-%-------------------------------------------------------------------------%
-
-end
diff --git a/plotly/plotlyfig_aux/helpers/extractScatterMarker.m b/plotly/plotlyfig_aux/helpers/extractScatterMarker.m
index 4f4490c2..8961032c 100644
--- a/plotly/plotlyfig_aux/helpers/extractScatterMarker.m
+++ b/plotly/plotlyfig_aux/helpers/extractScatterMarker.m
@@ -1,18 +1,17 @@
function marker = extractScatterMarker(plotData)
-
- %+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%
- % %
- % %-DESCRIPTION-% %
- % %
- % EXTRACTS THE MARKER STYLE USED FOR MATLAB OBJECTS OF TYPE "PATCH". %
- % THESE OBJECTS ARE USED IN AREASERIES BARSERIES, CONTOURGROUP, %
- % SCATTERGROUP. %
- % %
- %+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%
+ %+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%
+ % %
+ % %-DESCRIPTION-% %
+ % %
+ % EXTRACTS THE MARKER STYLE USED FOR MATLAB OBJECTS OF TYPE "PATCH". %
+ % THESE OBJECTS ARE USED IN AREASERIES BARSERIES, CONTOURGROUP, %
+ % SCATTERGROUP. %
+ % %
+ %+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%
%-INITIALIZATIONS-%
- axisData = ancestor(plotData.Parent,'axes');
- figureData = ancestor(plotData.Parent,'figure');
+ axisData = ancestor(plotData.Parent, 'axes');
+ figureData = ancestor(plotData.Parent, 'figure');
marker = struct();
marker.sizeref = 1;
@@ -21,14 +20,13 @@
marker.line.width = 1.5*plotData.LineWidth;
filledMarkerSet = {'o', 'square', 's', 'diamond', 'd', 'v', '^', ...
- '<', '>', 'hexagram', 'pentagram'};
+ '<', '>', 'hexagram', 'pentagram'};
filledMarker = ismember(plotData.Marker, filledMarkerSet);
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-get marker symbol-%
if ~strcmp(plotData.Marker,'none')
-
switch plotData.Marker
case '.'
markerSymbol = 'circle';
@@ -58,40 +56,32 @@
case {'h','hexagram'}
markerSymbol = 'hexagram';
end
-
marker.symbol = markerSymbol;
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-marker fill-%
markerFaceColor = plotData.MarkerFaceColor;
markerFaceAlpha = plotData.MarkerFaceAlpha;
if filledMarker
-
%-get face color-%
if isnumeric(markerFaceColor)
faceColor = sprintf('rgb(%f,%f,%f)', 255*markerFaceColor);
-
else
switch markerFaceColor
-
case 'none'
faceColor = 'rgba(0,0,0,0)';
-
case 'auto'
if ~strcmp(axisData.Color,'none')
faceColor = 255*axisData.Color;
else
faceColor = 255*figureData.Color;
end
-
faceColor = getStringColor(faceColor);
-
case 'flat'
faceColor = getScatterFlatColor(plotData, axisData);
-
end
end
@@ -100,24 +90,20 @@
faceAlpha = markerFaceAlpha;
else
switch markerFaceColor
-
case 'none'
faceAlpha = 1;
-
case 'flat'
aLim = axisData.ALim;
faceAlpha = plotData.AlphaData;
faceAlpha = rescaleData(faceAlpha, aLim);
end
end
-
%-set marker fill-%
marker.color = faceColor;
marker.opacity = faceAlpha;
-
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
%-marker line-%
markerEdgeColor = plotData.MarkerEdgeColor;
@@ -125,27 +111,19 @@
if isnumeric(markerEdgeColor)
lineColor = sprintf('rgb(%f,%f,%f)', 255*markerEdgeColor);
-
else
switch markerEdgeColor
-
case 'none'
lineColor = 'rgba(0,0,0,0)';
-
case 'auto'
-
if ~strcmp(axisData.Color,'none')
lineColor = 255*axisData.Color;
else
lineColor = 255*figureData.Color;
end
-
lineColor = getStringColor(lineColor, markerEdgeAlpha);
-
case 'flat'
-
lineColor = getScatterFlatColor(plotData, axisData);
-
end
end
@@ -153,16 +131,13 @@
marker.line.color = lineColor;
else
marker.color = lineColor;
- if strcmp(plotData.Marker, '.'), marker.line.color = lineColor; end
+ if strcmp(plotData.Marker, '.')
+ marker.line.color = lineColor;
+ end
end
-
- %-------------------------------------------------------------------------%
end
function flatColor = getScatterFlatColor(plotData, axisData, opacity)
-
- %-------------------------------------------------------------------------%
-
cData = plotData.CData;
colorMap = axisData.Colormap;
cLim = axisData.CLim;
@@ -175,7 +150,7 @@
cDataByIndex = lenCData == nMarkers || lenCData == 1;
end
- %-------------------------------------------------------------------------%
+ %---------------------------------------------------------------------%
if cDataByIndex
cMapInd = getcMapInd(cData, cLim, nColors);
@@ -192,8 +167,6 @@
flatColor{n} = getStringColor(numColor(n, :));
end
end
-
- %-------------------------------------------------------------------------%
end
function cMapInd = getcMapInd(cData, cLim, nColors)
diff --git a/plotly/plotlyfig_aux/helpers/extractScatterhistogramMarker.m b/plotly/plotlyfig_aux/helpers/extractScatterhistogramMarker.m
index 634705ce..5257ab06 100644
--- a/plotly/plotlyfig_aux/helpers/extractScatterhistogramMarker.m
+++ b/plotly/plotlyfig_aux/helpers/extractScatterhistogramMarker.m
@@ -1,127 +1,109 @@
function marker = extractScatterhistogramMarker(patch_data, t)
-
-% EXTRACTS THE MARKER STYLE USED FOR MATLAB OBJECTS
-% OF TYPE "PATCH". THESE OBJECTS ARE USED IN AREASERIES
-% BARSERIES, CONTOURGROUP, SCATTERGROUP.
-
-%-------------------------------------------------------------------------%
-
-%-AXIS STRUCTURE-%
-axis_data = ancestor(patch_data.Parent,'axes');
-
-%-FIGURE STRUCTURE-%
-figure_data = ancestor(patch_data.Parent,'figure');
-
-%-INITIALIZE OUTPUT-%
-marker = struct();
-
-%-------------------------------------------------------------------------%
-
-%-MARKER SIZE (STYLE)-%
-marker.size = patch_data.MarkerSize(t)*0.20;
-
-%-------------------------------------------------------------------------%
-
-%-MARKER SYMBOL (STYLE)-%
-if ~strcmp(patch_data.MarkerStyle(t),'none')
-
- switch patch_data.MarkerStyle(t)
- case '.'
- marksymbol = 'circle';
- case 'o'
- marksymbol = 'circle';
- case 'x'
- marksymbol = 'x-thin-open';
- case '+'
- marksymbol = 'cross-thin-open';
- case '*'
- marksymbol = 'asterisk-open';
- case {'s','square'}
- marksymbol = 'square';
- case {'d','diamond'}
- marksymbol = 'diamond';
- case 'v'
- marksymbol = 'triangle-down';
- case '^'
- marksymbol = 'triangle-up';
- case '<'
- marksymbol = 'triangle-left';
- case '>'
- marksymbol = 'triangle-right';
- case {'p','pentagram'}
- marksymbol = 'star';
- case {'h','hexagram'}
- marksymbol = 'hexagram';
+ % EXTRACTS THE MARKER STYLE USED FOR MATLAB OBJECTS
+ % OF TYPE "PATCH". THESE OBJECTS ARE USED IN AREASERIES
+ % BARSERIES, CONTOURGROUP, SCATTERGROUP.
+
+ %---------------------------------------------------------------------%
+
+ %-AXIS STRUCTURE-%
+ axis_data = ancestor(patch_data.Parent, 'axes');
+
+ %-FIGURE STRUCTURE-%
+ figure_data = ancestor(patch_data.Parent, 'figure');
+
+ %-INITIALIZE OUTPUT-%
+ marker = struct();
+
+ %---------------------------------------------------------------------%
+
+ %-MARKER SIZE (STYLE)-%
+ marker.size = patch_data.MarkerSize(t)*0.20;
+
+ %---------------------------------------------------------------------%
+
+ %-MARKER SYMBOL (STYLE)-%
+ if ~strcmp(patch_data.MarkerStyle(t), 'none')
+ switch patch_data.MarkerStyle(t)
+ case '.'
+ marksymbol = 'circle';
+ case 'o'
+ marksymbol = 'circle';
+ case 'x'
+ marksymbol = 'x-thin-open';
+ case '+'
+ marksymbol = 'cross-thin-open';
+ case '*'
+ marksymbol = 'asterisk-open';
+ case {'s','square'}
+ marksymbol = 'square';
+ case {'d','diamond'}
+ marksymbol = 'diamond';
+ case 'v'
+ marksymbol = 'triangle-down';
+ case '^'
+ marksymbol = 'triangle-up';
+ case '<'
+ marksymbol = 'triangle-left';
+ case '>'
+ marksymbol = 'triangle-right';
+ case {'p','pentagram'}
+ marksymbol = 'star';
+ case {'h','hexagram'}
+ marksymbol = 'hexagram';
+ end
+ marker.symbol = marksymbol;
end
-
- marker.symbol = marksymbol;
-end
-%-------------------------------------------------------------------------%
-
-%-MARKER LINE WIDTH (STYLE)-%
-marker.line.width = patch_data.LineWidth(t);
-
-%-------------------------------------------------------------------------%
-
-%--MARKER COLOR--%
-
-%-figure colormap-%
-colormap = figure_data.Colormap;
-
-% marker face color
-MarkerColor = patch_data.Color(t, :);
-
-filledMarkerSet = {'o','square','s','diamond','d',...
- 'v','^', '<','>','hexagram','pentagram'};
-
-filledMarker = ismember(patch_data.MarkerStyle(t), filledMarkerSet);
-
-if filledMarker && strcmp(patch_data.MarkerFilled, 'on')
-
- if isnumeric(MarkerColor)
- markercolor = sprintf('rgb(%f,%f,%f)', 255*MarkerColor);
- else
-
- switch MarkerColor
-
- case 'none'
-
- markercolor = 'rgba(0,0,0,0)';
-
- case 'auto'
-
- if ~strcmp(axis_data.Color,'none')
- col = 255*axis_data.Color;
- else
- col = 255*figure_data.Color;
- end
-
- markercolor = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];
-
-
- case 'flat'
-
- for n = 1:length(patch_data.CData)
-
- capCD = max(min(patch_data.CData(n),axis_data.CLim(2)),axis_data.CLim(1));
- scalefactor = (capCD - axis_data.CLim(1))/diff(axis_data.CLim);
- col = 255*(colormap(1 + floor(scalefactor*(length(colormap)-1)),:));
-
- markercolor{n} = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];
-
- end
+ %---------------------------------------------------------------------%
+
+ %-MARKER LINE WIDTH (STYLE)-%
+ marker.line.width = patch_data.LineWidth(t);
+
+ %---------------------------------------------------------------------%
+
+ %--MARKER COLOR--%
+
+ %-figure colormap-%
+ colormap = figure_data.Colormap;
+
+ % marker face color
+ MarkerColor = patch_data.Color(t, :);
+
+ filledMarkerSet = {'o','square','s','diamond','d',...
+ 'v','^', '<','>','hexagram','pentagram'};
+
+ filledMarker = ismember(patch_data.MarkerStyle(t), filledMarkerSet);
+
+ if filledMarker && strcmp(patch_data.MarkerFilled, 'on')
+ if isnumeric(MarkerColor)
+ markercolor = sprintf('rgb(%f,%f,%f)', 255*MarkerColor);
+ else
+ switch MarkerColor
+ case 'none'
+ markercolor = 'rgba(0,0,0,0)';
+ case 'auto'
+ if ~strcmp(axis_data.Color,'none')
+ col = 255*axis_data.Color;
+ else
+ col = 255*figure_data.Color;
+ end
+ markercolor = sprintf("rgb(%f,%f,%f)", col);
+ case 'flat'
+ for n = 1:length(patch_data.CData)
+ capCD = max(min(patch_data.CData(n), ...
+ axis_data.CLim(2)), axis_data.CLim(1));
+ scalefactor = (capCD - axis_data.CLim(1)) ...
+ /diff(axis_data.CLim);
+ col = 255*(colormap(1 + floor(scalefactor ...
+ * (length(colormap)-1)),:));
+ markercolor{n} = sprintf("rgb(%f,%f,%f)", col);
+ end
+ end
end
+ marker.color = markercolor;
end
-
- marker.color = markercolor;
-
-end
-
-if filledMarker
- marker.line.color = markercolor;
-end
-
-%-------------------------------------------------------------------------%
+ if filledMarker
+ marker.line.color = markercolor;
+ end
end
diff --git a/plotly/plotlyfig_aux/helpers/findColorbarAxis.m b/plotly/plotlyfig_aux/helpers/findColorbarAxis.m
index f58f8b21..2efd8c8c 100644
--- a/plotly/plotlyfig_aux/helpers/findColorbarAxis.m
+++ b/plotly/plotlyfig_aux/helpers/findColorbarAxis.m
@@ -1,17 +1,21 @@
function colorbarAxis = findColorbarAxis(obj,colorbarHandle)
-
if isHG2
- colorbarAxisIndex = find(arrayfun(@(x)(isequal(getappdata(x.Handle,'ColorbarPeerHandle'),colorbarHandle)),obj.State.Axis));
-
+ colorbarAxisIndex = find(arrayfun(@(x) isequal( ...
+ getappdata(x.Handle,'ColorbarPeerHandle'), ...
+ colorbarHandle),obj.State.Axis));
% If the above returns empty then we are on a more recent Matlab
% release where the appdata entry is called LayoutPeers
if isempty(colorbarAxisIndex)
- colorbarAxisIndex = find(arrayfun(@(x)(isequal(getappdata(x.Handle,'LayoutPeers'),colorbarHandle)),obj.State.Axis));
+ colorbarAxisIndex = find(arrayfun(@(x) isequal( ...
+ getappdata(x.Handle,'LayoutPeers'), ...
+ colorbarHandle), obj.State.Axis));
end
-
else
- colorbarAxisIndex = find(arrayfun(@(x)(isequal(getappdata(x.Handle,'LegendColorbarInnerList'),colorbarHandle) + ...
- isequal(getappdata(x.Handle,'LegendColorbarOuterList'),colorbarHandle)),obj.State.Axis));
+ colorbarAxisIndex = find(arrayfun(@(x) isequal( ...
+ getappdata(x.Handle,'LegendColorbarInnerList'), ...
+ colorbarHandle) + isequal(getappdata(x.Handle, ...
+ 'LegendColorbarOuterList'), colorbarHandle), ...
+ obj.State.Axis));
end
try
@@ -19,5 +23,4 @@
catch
colorbarAxis = 1;
end
-
end
diff --git a/plotly/plotlyfig_aux/helpers/findColorbarData.m b/plotly/plotlyfig_aux/helpers/findColorbarData.m
index 19d89333..a810eb7d 100644
--- a/plotly/plotlyfig_aux/helpers/findColorbarData.m
+++ b/plotly/plotlyfig_aux/helpers/findColorbarData.m
@@ -1,24 +1,19 @@
function colorbarDataIndex = findColorbarData(obj, colorbarIndex, colorbarData)
-
if nargin == 2
-
%locate index of data associated with colorbar
colorbarDataIndex = find( ...
arrayfun( @(x)eq(x.AssociatedAxis, ...
obj.State.Colorbar(colorbarIndex).AssociatedAxis), ...
obj.State.Plot ...
), ...
- 1 );
-
+ 1);
%if no matching data index found
if isempty(colorbarDataIndex)
colorbarDataIndex = max(min(colorbarIndex,obj.State.Figure.NumPlots),1);
end
-
elseif nargin == 3
c = 1; a = 1;
allAxesIndex = zeros(length(colorbarData.Parent.Children), 1);
-
for n = 1:length(colorbarData.Parent.Children)
if strcmp(colorbarData.Parent.Children(n).Type, 'colorbar')
allColorbarIndex(c) = n;
@@ -28,12 +23,9 @@
a = a + 1;
end
end
-
colorbarAxisIndex = allColorbarIndex(colorbarIndex) + 1;
colorbarAxisIndex = allAxesIndex(colorbarAxisIndex);
colorbarDataIndex = obj.State.Figure.NumAxes - colorbarAxisIndex + 1;
-
colorbarDataIndex = colorbarDataIndex;
end
-
end
\ No newline at end of file
diff --git a/plotly/plotlyfig_aux/helpers/findLegendAxis.m b/plotly/plotlyfig_aux/helpers/findLegendAxis.m
index dd604264..73f0ff40 100644
--- a/plotly/plotlyfig_aux/helpers/findLegendAxis.m
+++ b/plotly/plotlyfig_aux/helpers/findLegendAxis.m
@@ -1,9 +1,12 @@
function legendAxis = findLegendAxis(obj,legendHandle)
- if verLessThan('matlab','9.0.0')
- legendAxisIndex = find(arrayfun(@(x)(isequal(handle(getappdata(x.Handle,'LegendPeerHandle')),legendHandle)),obj.State.Axis), 1);
- else
- legendAxisIndex = find(arrayfun(@(x)(isequal(handle(x.Handle.Legend),legendHandle)),obj.State.Axis), 1);
- end
+ if verLessThan('matlab','9.0.0')
+ legendAxisIndex = find(arrayfun(@(x) isequal( ...
+ handle(getappdata(x.Handle, 'LegendPeerHandle')), ...
+ legendHandle), obj.State.Axis), 1);
+ else
+ legendAxisIndex = find(arrayfun(@(x) isequal( ...
+ handle(x.Handle.Legend), legendHandle), obj.State.Axis), 1);
+ end
- legendAxis = obj.State.Axis(legendAxisIndex).Handle;
+ legendAxis = obj.State.Axis(legendAxisIndex).Handle;
end
diff --git a/plotly/plotlyfig_aux/helpers/findSourceAxis.m b/plotly/plotlyfig_aux/helpers/findSourceAxis.m
index f83bdd4c..1e394b95 100644
--- a/plotly/plotlyfig_aux/helpers/findSourceAxis.m
+++ b/plotly/plotlyfig_aux/helpers/findSourceAxis.m
@@ -1,5 +1,4 @@
function [xsource, ysource, xoverlay, yoverlay] = findSourceAxis(obj, axIndex, yaxIndex)
-
% initialize output
xsource = axIndex;
ysource = axIndex;
@@ -11,12 +10,14 @@
% find x/y source axis (takes non-identity overlapaxes as source)
if overlapping
- if isequal(obj.State.Axis(axIndex).Handle.XAxisLocation, obj.State.Axis(overlapaxes(1)).Handle.XAxisLocation)
+ if isequal(obj.State.Axis(axIndex).Handle.XAxisLocation, ...
+ obj.State.Axis(overlapaxes(1)).Handle.XAxisLocation)
xsource = overlapaxes(1);
else
xoverlay = overlapaxes(1);
end
- if isequal(obj.State.Axis(axIndex).Handle.YAxisLocation, obj.State.Axis(overlapaxes(1)).Handle.YAxisLocation)
+ if isequal(obj.State.Axis(axIndex).Handle.YAxisLocation, ...
+ obj.State.Axis(overlapaxes(1)).Handle.YAxisLocation)
ysource = overlapaxes(1);
else
yoverlay = overlapaxes(1);
@@ -30,5 +31,4 @@
ysource = axIndex + obj.State.Figure.NumAxes;
end
end
-
end
diff --git a/plotly/plotlyfig_aux/helpers/formatRW.m b/plotly/plotlyfig_aux/helpers/formatRW.m
index 32706966..01ae49c3 100644
--- a/plotly/plotlyfig_aux/helpers/formatRW.m
+++ b/plotly/plotlyfig_aux/helpers/formatRW.m
@@ -1,41 +1,40 @@
function outputStr = formatRW(inputStr)
-%adds whitespace after \reservedwordplot(1,1);
+ %adds whitespace after \reservedwordplot(1,1);
-inputStrCell = cell(1,length(inputStr));
+ inputStrCell = cell(1,length(inputStr));
-for c = 1:length(inputStr)
- inputStrCell{c} = inputStr(c);
-end
+ for c = 1:length(inputStr)
+ inputStrCell{c} = inputStr(c);
+ end
-rW = {'\\alpha','\\upsilon','\\sim','\\angle','\\phi','\\leq',...
- '\\ast','\\chi','\\infty','\\beta','\\psi','\\clubsuit',...
- '\\gamma','\\omega','\\diamondsuit','\\delta',...
- '\\Gamma','\\heartsuit','\\epsilon','\\Delta',...
- '\\spadesuit','\\zeta','\\Theta','\\leftrightarrow',...
- '\\eta','\\Lambda','\\leftarrow','\\theta','\\Xi',...
- '\\Leftarrow','\\vartheta','\\Pi','\\uparrow',...
- '\\iota','\\Sigma','\\rightarrow','\\kappa',...
- '\\Upsilon','\\Rightarrow','\\lambda','\\Phi',...
- '\\downarrow','\\mu','\\Psi','\\circ','\\nu',...
- '\\Omega','\\pm','\\xi','\\forall','\\geq','\\pi',...
- '\\exists','\\propto','\\rho','\\ni','\\partial',...
- '\\sigma','\\cong','\\bullet','\\varsigma',...
- '\\approx','\\div','\\tau','\\Re','\\neq','\\equiv',...
- '\\oplus','\\aleph','\\Im','\\cup','\\wp','\\otimes',...
- '\\subseteq','\\oslash','\\cap','\\in','\\supseteq',...
- '\\supset','\\lceil','\\subset','\\int','\\cdot','\\o',...
- '\\rfloor','\\neg','\\nabla','\\lfloor','\\times','\\lots',...
- '\\perp','\\surd','\\prime','\\wedge','\\varpi','\\0',...
- '\\rceil','\\rangle','\\mid','\\vee','\\copyright','\\langle'};
+ rW = {'\\alpha','\\upsilon','\\sim','\\angle','\\phi','\\leq',...
+ '\\ast','\\chi','\\infty','\\beta','\\psi','\\clubsuit',...
+ '\\gamma','\\omega','\\diamondsuit','\\delta',...
+ '\\Gamma','\\heartsuit','\\epsilon','\\Delta',...
+ '\\spadesuit','\\zeta','\\Theta','\\leftrightarrow',...
+ '\\eta','\\Lambda','\\leftarrow','\\theta','\\Xi',...
+ '\\Leftarrow','\\vartheta','\\Pi','\\uparrow',...
+ '\\iota','\\Sigma','\\rightarrow','\\kappa',...
+ '\\Upsilon','\\Rightarrow','\\lambda','\\Phi',...
+ '\\downarrow','\\mu','\\Psi','\\circ','\\nu',...
+ '\\Omega','\\pm','\\xi','\\forall','\\geq','\\pi',...
+ '\\exists','\\propto','\\rho','\\ni','\\partial',...
+ '\\sigma','\\cong','\\bullet','\\varsigma',...
+ '\\approx','\\div','\\tau','\\Re','\\neq','\\equiv',...
+ '\\oplus','\\aleph','\\Im','\\cup','\\wp','\\otimes',...
+ '\\subseteq','\\oslash','\\cap','\\in','\\supseteq',...
+ '\\supset','\\lceil','\\subset','\\int','\\cdot','\\o',...
+ '\\rfloor','\\neg','\\nabla','\\lfloor','\\times','\\lots',...
+ '\\perp','\\surd','\\prime','\\wedge','\\varpi','\\0',...
+ '\\rceil','\\rangle','\\mid','\\vee','\\copyright','\\langle'};
-for w = 1:length(rW)
- [startInd endInd] = regexp(inputStr,rW{w});
- for ind = 1:length(endInd)
- %add space at end of reserved words
- inputStrCell{endInd(ind)} = [inputStrCell{endInd(ind)} ' '];
+ for w = 1:length(rW)
+ [startInd endInd] = regexp(inputStr,rW{w});
+ for ind = 1:length(endInd)
+ %add space at end of reserved words
+ inputStrCell{endInd(ind)} = [inputStrCell{endInd(ind)} ' '];
+ end
end
-end
-
-outputStr = [inputStrCell{:}];
+ outputStr = [inputStrCell{:}];
end
\ No newline at end of file
diff --git a/plotly/plotlyfig_aux/helpers/generateBoxData.m b/plotly/plotlyfig_aux/helpers/generateBoxData.m
index 452cc5e5..79d1eb40 100644
--- a/plotly/plotlyfig_aux/helpers/generateBoxData.m
+++ b/plotly/plotlyfig_aux/helpers/generateBoxData.m
@@ -1,21 +1,19 @@
function y = generateBoxData(outliers, boxmin, Q2, med, Q3, boxmax)
+ %set number of data points
+ N = numel(outliers)*5+20;
-%set number of data points
-N = numel(outliers)*5+20;
+ %find percentile numbers
+ Q1Index = round(N*25/100);
+ Q2Index = round(N*50/100);
+ Q3Index = round(N*75/100);
-%find percentile numbers
-Q1Index = round(N*25/100);
-Q2Index = round(N*50/100);
-Q3Index = round(N*75/100);
-
-outlierlow = outliers(outliersmed);
-
-y=[outlierlow ...
- linspace(boxmin, Q2, Q1Index-numel(outlierlow)) ...
- linspace(Q2, med, Q2Index-Q1Index) ...
- linspace(med, Q3, Q3Index-Q2Index) ...
- linspace(Q3, boxmax, N-Q3Index-numel(outlierhigh)) ...
- outlierhigh];
+ outlierlow = outliers(outliersmed);
+ y = [outlierlow ...
+ linspace(boxmin, Q2, Q1Index-numel(outlierlow)) ...
+ linspace(Q2, med, Q2Index-Q1Index) ...
+ linspace(med, Q3, Q3Index-Q2Index) ...
+ linspace(Q3, boxmax, N-Q3Index-numel(outlierhigh)) ...
+ outlierhigh];
end
\ No newline at end of file
diff --git a/plotly/plotlyfig_aux/helpers/getGraphClass.m b/plotly/plotlyfig_aux/helpers/getGraphClass.m
index ab794023..742471d7 100644
--- a/plotly/plotlyfig_aux/helpers/getGraphClass.m
+++ b/plotly/plotlyfig_aux/helpers/getGraphClass.m
@@ -1,7 +1,7 @@
function gc = getGraphClass(obj)
-if isHG2
- gc = lower(obj.Type);
-else
- gc = lower(handle(obj).classhandle.name);
-end
+ if isHG2
+ gc = lower(obj.Type);
+ else
+ gc = lower(handle(obj).classhandle.name);
+ end
end
\ No newline at end of file
diff --git a/plotly/plotlyfig_aux/helpers/getScatterMode.m b/plotly/plotlyfig_aux/helpers/getScatterMode.m
index 0c3096cd..cf76a9ee 100644
--- a/plotly/plotlyfig_aux/helpers/getScatterMode.m
+++ b/plotly/plotlyfig_aux/helpers/getScatterMode.m
@@ -1,19 +1,14 @@
function scatterMode = getScatterMode(plotData)
-
marker = plotData.Marker;
lineStyle = plotData.LineStyle;
if ~strcmpi('none', marker) && ~strcmpi('none', lineStyle)
scatterMode = 'lines+markers';
-
elseif ~strcmpi('none', marker)
scatterMode = 'markers';
-
elseif ~strcmpi('none', lineStyle)
scatterMode = 'lines';
-
else
scatterMode = 'none';
-
end
-end
\ No newline at end of file
+end
diff --git a/plotly/plotlyfig_aux/helpers/getShowLegend.m b/plotly/plotlyfig_aux/helpers/getShowLegend.m
index 35a2cf79..ee3549cf 100644
--- a/plotly/plotlyfig_aux/helpers/getShowLegend.m
+++ b/plotly/plotlyfig_aux/helpers/getShowLegend.m
@@ -1,18 +1,16 @@
function showLegend = getShowLegend(plotData)
try
leg = plotData.Annotation;
- legInfo = leg.LegendInformation;
+ legInfo = leg.LegendInformation;
- switch legInfo.IconDisplayStyle
- case 'on'
- showLegend = true;
- case 'off'
- showLegend = false;
- end
-
- showLegend = showLegend & ~isempty(plotData.DisplayName);
-
- catch
- showLegend = false;
- end
+ switch legInfo.IconDisplayStyle
+ case 'on'
+ showLegend = true;
+ case 'off'
+ showLegend = false;
+ end
+ showLegend = showLegend & ~isempty(plotData.DisplayName);
+ catch
+ showLegend = false;
+ end
end
diff --git a/plotly/plotlyfig_aux/helpers/getStringColor.m b/plotly/plotlyfig_aux/helpers/getStringColor.m
index c1518f85..d3feffad 100644
--- a/plotly/plotlyfig_aux/helpers/getStringColor.m
+++ b/plotly/plotlyfig_aux/helpers/getStringColor.m
@@ -1,12 +1,9 @@
function stringColor = getStringColor(numColor, opacity)
-
if nargin == 1
stringColor = sprintf('rgb(%f,%f,%f)', numColor);
-
elseif nargin == 2
stringColor = sprintf('rgba(%f,%f,%f,%f)', numColor, opacity);
-
else
disp('Too many input arguments for getStringColor function.')
end
-end
\ No newline at end of file
+end
diff --git a/plotly/plotlyfig_aux/helpers/handleFileName.m b/plotly/plotlyfig_aux/helpers/handleFileName.m
index f5a232c2..cfbf690f 100644
--- a/plotly/plotlyfig_aux/helpers/handleFileName.m
+++ b/plotly/plotlyfig_aux/helpers/handleFileName.m
@@ -1,28 +1,26 @@
function handleFileName(obj)
+ %--IF EMPTY FILENAME, CHECK FOR PLOT TITLES--%
+ try
+ if isempty(obj.PlotOptions.FileName)
+ for t = 1:obj.State.Figure.NumTexts
+ if obj.State.Text(t).Title
+ str = obj.State.Text(t).Handle.String;
+ interp = obj.State.Text(t).Handle.Interpreter;
+ obj.PlotOptions.FileName = parseString(str, interp);
-%--IF EMPTY FILENAME, CHECK FOR PLOT TITLES--%
-try
- if isempty(obj.PlotOptions.FileName)
- for t = 1:obj.State.Figure.NumTexts
- if obj.State.Text(t).Title
- str = obj.State.Text(t).Handle.String;
- interp = obj.State.Text(t).Handle.Interpreter;
- obj.PlotOptions.FileName = parseString(str,interp);
-
- % untitle.html if \text exist (special chars)
- if ~isempty(strfind(obj.PlotOptions.FileName, '\text'))
- obj.PlotOptions.FileName = 'untitled';
+ % untitle.html if \text exist (special chars)
+ if ~isempty(strfind(obj.PlotOptions.FileName, '\text'))
+ obj.PlotOptions.FileName = 'untitled';
+ end
end
end
end
+ catch
+ obj.PlotOptions.FileName = 'untitled';
end
-catch
- obj.PlotOptions.FileName = 'untitled';
-end
-
-%--IF FILENAME IS STILL EMPTY SET TO UNTITLED--%
-if isempty(obj.PlotOptions.FileName)
- obj.PlotOptions.FileName = 'untitled';
-end
+ %--IF FILENAME IS STILL EMPTY SET TO UNTITLED--%
+ if isempty(obj.PlotOptions.FileName)
+ obj.PlotOptions.FileName = 'untitled';
+ end
end
diff --git a/plotly/plotlyfig_aux/helpers/histogramOrientation.m b/plotly/plotlyfig_aux/helpers/histogramOrientation.m
index f9314d3d..f366bdcb 100644
--- a/plotly/plotlyfig_aux/helpers/histogramOrientation.m
+++ b/plotly/plotlyfig_aux/helpers/histogramOrientation.m
@@ -1,22 +1,24 @@
function orientation = histogramOrientation(hist_data)
+ %initialize output
+ orientation = [];
-%initialize output
-orientation = [];
-
-try
- %check to see if patch is in the shape of "vertical" rectangles :)
- if size(hist_data.XData,1)==4 && size(hist_data.XData, 2) > 1 && ...
- all(hist_data.XData(1,:)==hist_data.XData(2,:)) && ...
- all(hist_data.XData(3,:)==hist_data.XData(4,:)) && ...
- all(hist_data.YData(1,:)==hist_data.YData(4,:)) && ...
- all(hist_data.YData(2,:)==hist_data.YData(3,:));
- orientation = 'v';
- %check to see if patch is in the shape of "horizontal" rectangles :)
- elseif size(hist_data.YData,1)==4 && size(hist_data.YData, 2) > 1 && ...
- all(hist_data.YData(1,:)==hist_data.YData(2,:)) && ...
- all(hist_data.YData(3,:)==hist_data.YData(4,:)) && ...
- all(hist_data.XData(1,:)==hist_data.XData(4,:)) && ...
- all(hist_data.XData(2,:)==hist_data.XData(3,:));
- orientation = 'h';
+ try
+ % check to see if patch is in the shape of "vertical" rectangles :)
+ if size(hist_data.XData,1) == 4 ...
+ && size(hist_data.XData, 2) > 1 ...
+ && all(hist_data.XData(1,:) == hist_data.XData(2,:)) ...
+ && all(hist_data.XData(3,:) == hist_data.XData(4,:)) ...
+ && all(hist_data.YData(1,:) == hist_data.YData(4,:)) ...
+ && all(hist_data.YData(2,:) == hist_data.YData(3,:))
+ orientation = 'v';
+ % check to see if patch is in the shape of "horizontal" rectangles :)
+ elseif size(hist_data.YData,1) == 4 ...
+ && size(hist_data.YData, 2) > 1 ...
+ && all(hist_data.YData(1,:) == hist_data.YData(2,:)) ...
+ && all(hist_data.YData(3,:) == hist_data.YData(4,:)) ...
+ && all(hist_data.XData(1,:) == hist_data.XData(4,:)) ...
+ && all(hist_data.XData(2,:) == hist_data.XData(3,:))
+ orientation = 'h';
+ end
end
-end
\ No newline at end of file
+end
diff --git a/plotly/plotlyfig_aux/helpers/isBoxplot.m b/plotly/plotlyfig_aux/helpers/isBoxplot.m
index 95679122..c26f2f2c 100644
--- a/plotly/plotlyfig_aux/helpers/isBoxplot.m
+++ b/plotly/plotlyfig_aux/helpers/isBoxplot.m
@@ -1,3 +1,5 @@
function check = isBoxplot(obj, boxIndex)
- check = ~isempty([findobj(obj.State.Plot(boxIndex).Handle,'Tag', 'Box')' findobj(obj.State.Plot(boxIndex).Handle,'Tag', 'Outliers')']);
+ check = ~isempty([ ...
+ findobj(obj.State.Plot(boxIndex).Handle,'Tag', 'Box')' ...
+ findobj(obj.State.Plot(boxIndex).Handle,'Tag', 'Outliers')']);
end
diff --git a/plotly/plotlyfig_aux/helpers/isExceptionStrip.m b/plotly/plotlyfig_aux/helpers/isExceptionStrip.m
index b27ce647..130ac4bf 100644
--- a/plotly/plotlyfig_aux/helpers/isExceptionStrip.m
+++ b/plotly/plotlyfig_aux/helpers/isExceptionStrip.m
@@ -1,20 +1,19 @@
function check = isExceptionStrip(grstruct, fieldname)
+ % initialize output
+ check = false;
-% initialize output
-check = false;
+ % exception list {fieldname, val_types}
+ exceptions = {'color', @iscell, 'width', @(x)(length(x)>1), ...
+ 'size', @(x)(length(x)>1)};
-% exception list {fieldname, val_types}
-exceptions = {'color', @iscell, 'width', @(x)(length(x)>1), 'size', @(x)(length(x)>1)};
-
-for e = 1:2:length(exceptions)
-
- %comparison function
- compfun = exceptions{e+1};
-
- % look for fieldnames of type exceptions{e} and compare the underyling data using exceptions{e+1}
- if strcmp(fieldname, exceptions{e}) && compfun(grstruct.(fieldname))
- check = true;
+ for e = 1:2:length(exceptions)
+ % comparison function
+ compfun = exceptions{e+1};
+ % look for fieldnames of type exceptions{e} and compare the
+ % underyling data using exceptions{e+1}
+ if strcmp(fieldname, exceptions{e}) ...
+ && compfun(grstruct.(fieldname))
+ check = true;
+ end
end
-
end
-end
\ No newline at end of file
diff --git a/plotly/plotlyfig_aux/helpers/isHG2.m b/plotly/plotlyfig_aux/helpers/isHG2.m
index 770bf28e..7c66215c 100644
--- a/plotly/plotlyfig_aux/helpers/isHG2.m
+++ b/plotly/plotlyfig_aux/helpers/isHG2.m
@@ -1,4 +1,4 @@
function check = isHG2
-%check for HG2 update
-check = ~verLessThan('matlab','8.4.0');
+ %check for HG2 update
+ check = ~verLessThan('matlab','8.4.0');
end
diff --git a/plotly/plotlyfig_aux/helpers/isHistogram.m b/plotly/plotlyfig_aux/helpers/isHistogram.m
index 61307210..ecf2e791 100644
--- a/plotly/plotlyfig_aux/helpers/isHistogram.m
+++ b/plotly/plotlyfig_aux/helpers/isHistogram.m
@@ -1,4 +1,4 @@
function check = isHistogram(obj, dataIndex)
-hist_data = obj.State.Plot(dataIndex).Handle;
-check = ~isempty(histogramOrientation(hist_data));
+ hist_data = obj.State.Plot(dataIndex).Handle;
+ check = ~isempty(histogramOrientation(hist_data));
end
diff --git a/plotly/plotlyfig_aux/helpers/isMultipleBaseline.m b/plotly/plotlyfig_aux/helpers/isMultipleBaseline.m
index a7ddf971..b3a245f9 100644
--- a/plotly/plotlyfig_aux/helpers/isMultipleBaseline.m
+++ b/plotly/plotlyfig_aux/helpers/isMultipleBaseline.m
@@ -1,5 +1,10 @@
function check = isMultipleBaseline(obj, baselineIndex)
-% check for multiple baselines up to baselineIndex
-baselines = find(arrayfun(@(x)(strcmp(x.Class,'baseline') && eq(x.AssociatedAxis,obj.State.Plot(baselineIndex).AssociatedAxis)),obj.State.Plot(1:baselineIndex)));
-check = length(baselines) > 1; %greater than 1 because obj.State.Plot(baselineIndex).AssociatedAxis will always match
+ % check for multiple baselines up to baselineIndex
+ baselines = find(arrayfun(@(x) strcmp(x.Class,'baseline') ...
+ && eq(x.AssociatedAxis, ...
+ obj.State.Plot(baselineIndex).AssociatedAxis), ...
+ obj.State.Plot(1:baselineIndex)));
+ % greater than 1 because obj.State.Plot(baselineIndex).AssociatedAxis
+ % will always match
+ check = length(baselines) > 1;
end
\ No newline at end of file
diff --git a/plotly/plotlyfig_aux/helpers/matlab2plotlyfont.m b/plotly/plotlyfig_aux/helpers/matlab2plotlyfont.m
index cd73a2e6..ca0fff02 100644
--- a/plotly/plotlyfig_aux/helpers/matlab2plotlyfont.m
+++ b/plotly/plotlyfig_aux/helpers/matlab2plotlyfont.m
@@ -1,576 +1,574 @@
function plotlyFont = matlab2plotlyfont(matlabFont)
+ % Plotly supported fonts
-%Plotly supported fonts
-
-try
-% availableFont = {'Arial, sans-serif', 'Balto, sans-serif' , ...
-% 'Courier New, monospace' , 'Droid Sans, sans-serif' ,...
-% 'Droid Serif, serif', 'Droid Sans Mono, sans-serif', ...
-% 'Georgia, serif' , 'Gravitas One, cursive' , ...
-% 'Old Standard TT, serif' , 'Open Sans, sans-serif', ...
-% 'PT Sans Narrow, sans-serif' , 'Raleway, sans-serif',...
-% 'Times New Roman, Times, serif'};
-
- switch matlabFont
-
- case 'Abadi MT Condensed Extra Bold'
- plotlyFont = 'Arial, sans-serif';
- case 'Abadi MT Condensed Light'
- plotlyFont = 'Balto, sans-serif';
- case 'Adobe Arabic'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Adobe Caslon Pro'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Adobe Fan Heiti Std'
- plotlyFont = 'Arial, sans-serif';
- case 'Adobe Fangsong Std'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Adobe Garamond Pro'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Adobe Gothic Std'
- plotlyFont = 'Arial, sans-serif';
- case 'Adobe Hebrew'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Adobe Heiti Std'
- plotlyFont = 'Droid Sans, sans-serif';
- case 'Adobe Kaiti Std'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Adobe Ming Std'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Adobe Myungjo Std'
- plotlyFont = 'Old Standard TT, serif';
- case 'Adobe Song Std'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Al Bayan'
- plotlyFont = 'Balto, sans-serif';
- case 'American Typewriter'
- plotlyFont = 'Old Standard TT, serif';
- case 'Andale Mono'
- plotlyFont = 'Droid Sans, sans-serif';
- case 'Apple Braille'
- plotlyFont = 'Balto, sans-serif';
- case'le Chancery'
- plotlyFont = 'Old Standard TT, serif';
- case 'Apple Color Emoji'
- plotlyFont = 'Balto, sans-serif';
- case 'Apple LiGothic'
- plotlyFont = 'Arial, sans-serif';
- case 'Apple LiSung'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Apple Symbols'
- plotlyFont = 'Balto, sans-serif';
- case 'AppleGothic'
- plotlyFont = 'Balto, sans-serif';
- case 'AppleMyungjo'
- plotlyFont = 'Old Standard TT, serif';
- case 'Arial'
- plotlyFont = 'Arial, sans-serif';
- case 'Arial Black'
- plotlyFont = 'Arial, sans-serif';
- case 'Arial Hebrew'
- plotlyFont = 'Arial, sans-serif';
- case 'Arial Narrow'
- plotlyFont = 'Arial, sans-serif';
- case 'Arial Rounded MT Bold'
- plotlyFont = 'Arial, sans-serif';
- case 'Arial Unicode MS'
- plotlyFont = 'Arial, sans-serif';
- case 'Ayuthaya'
- plotlyFont = 'Balto, sans-serif';
- case 'Baghdad'
- plotlyFont = 'Balto, sans-serif';
- case 'Bangla MN'
- plotlyFont ='Raleway, sans-serif';
- case 'Bangla Sangam MN'
- plotlyFont ='Raleway, sans-serif';
- case 'Baskerville'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Baskerville Old Face'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Batang'
- plotlyFont = 'Courier New, monospace';
- case 'Bauhaus 93'
- plotlyFont = 'Gravitas One, cursive';
- case 'Bell MT'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Bernard MT Condensed'
- plotlyFont = 'Gravitas One, cursive';
- case 'BiauKai'
- plotlyFont = 'Courier New, monospace';
- case 'Big Caslon'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Birch Std'
- plotlyFont = 'Droid Serif, serif';
- case 'Blackoak Std'
- plotlyFont = 'Gravitas One, cursive';
- case 'Book Antiqua'
- plotlyFont = 'Droid Serif, serif';
- case 'Bookman Old Style'
- plotlyFont = 'Balto, sans-serif';
- case 'Bookshelf Symbol 7'
- plotlyFont = 'Gravitas One, cursive';
- case 'Braggadocio'
- plotlyFont = 'Gravitas One, cursive';
- case 'Britannic Bold'
- plotlyFont = 'Courier New, monospace';
- case 'Brush Script MT'
- plotlyFont = 'Courier New, monospace';
- case 'Brush Script Std'
- plotlyFont = 'Courier New, monospace';
- case 'Calibri'
- plotlyFont = 'Balto, sans-serif';
- case 'Calisto MT'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Cambria'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Cambria Math'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Candara'
- plotlyFont = 'Raleway, sans-serif';
- case 'Century'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Century Gothic'
- plotlyFont = 'Balto, sans-serif';
- case 'Century Schoolbook'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Chalkboard'
- plotlyFont = 'Droid Sans, sans-serif';
- case 'Chalkduster'
- plotlyFont = 'Droid Sans, sans-serif';
- case 'Chaparral Pro'
- plotlyFont = 'Droid Serif, serif';
- case 'Charcoal CY'
- plotlyFont = 'Arial, sans-serif';
- case 'Charlemagne Std'
- plotlyFont = 'Old Standard TT, serif';
- case 'Cochin'
- plotlyFont = 'Old Standard TT, serif';
- case 'Colonna MT'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Comic Sans MS'
- plotlyFont = 'Droid Sans, sans-serif';
- case 'Consolas'
- plotlyFont = 'Balto, sans-serif';
- case 'Constantia'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Cooper Black'
- plotlyFont = 'Droid Sans, sans-serif';
- case 'Cooper Std'
- plotlyFont = 'Droid Sans, sans-serif';
- case 'Copperplate'
- plotlyFont = 'Old Standard TT, serif';
- case 'Copperplate Gothic Bold'
- plotlyFont = 'Old Standard TT, serif';
- case 'Copperplate Gothic Light'
- plotlyFont = 'Droid Serif, serif';
- case 'Corbel'
- plotlyFont = 'PT Sans Narrow, sans-serif';
- case 'Corsiva Hebrew'
- plotlyFont = 'Gravitas One, cursive';
- case 'Courier'
- plotlyFont = 'Courier New, monospace';
- case 'Courier New'
- plotlyFont = 'Courier New, monospace';
- case 'Curlz MT'
- plotlyFont = 'Gravitas One, cursive';
- case 'Damascus'
- plotlyFont = 'Arial, sans-serif';
- case 'DecoType Naskh'
- plotlyFont = 'Balto, sans-serif';
- case 'Desdemona'
- plotlyFont = 'Gravitas One, cursive';
- case 'Devanagari MT'
- plotlyFont = 'Old Standard TT, serif';
- case 'Devanagari Sangam MN'
- plotlyFont = 'Balto, sans-serif';
- case 'Dialog'
- plotlyFont = 'Raleway, sans-serif';
- case 'DialogInput'
- plotlyFont = 'Balto, sans-serif';
- case 'Didot'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Edwardian Script ITC'
- plotlyFont = 'Gravitas One, cursive';
- case 'Engravers MT'
- plotlyFont = 'Droid Serif, serif';
- case 'Euphemia UCAS'
- plotlyFont = 'Arial, sans-serif';
- case 'Eurostile'
- plotlyFont = 'Droid Sans, sans-serif';
- case 'Footlight MT Light'
- plotlyFont = 'Old Standard TT, serif';
- case 'Franklin Gothic Book'
- plotlyFont = 'Balto, sans-serif';
- case 'Franklin Gothic Medium'
- plotlyFont = 'Arial, sans-serif';
- case 'Futura'
- plotlyFont = 'Droid Sans, sans-serif';
- case 'Gabriola'
- plotlyFont = 'Gravitas One, cursive';
- case 'Garamond'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'GB18030 Bitmap'
- plotlyFont = 'Arial, sans-serif';
- case 'Geeza Pro'
- plotlyFont = 'Balto, sans-serif';
- case 'Geneva'
- plotlyFont = 'Balto, sans-serif';
- case 'Geneva CY'
- plotlyFont = 'Arial, sans-serif';
- case 'Georgia'
- plotlyFont = 'Old Standard TT, serif';
- case 'Giddyup Std'
- plotlyFont = 'Gravitas One, cursive';
- case 'Gill Sans'
- plotlyFont = 'Arial, sans-serif';
- case 'Gill Sans MT'
- plotlyFont = 'Arial, sans-serif';
- case 'Gill Sans Ultra Bold'
- plotlyFont = 'Arial, sans-serif';
- case 'Gloucester MT Extra Condensed'
- plotlyFont = 'Droid Sans, sans-serif';
- case 'Goudy Old Style'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Gujarati MT'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Gujarati Sangam MN'
- plotlyFont = 'Balto, sans-serif';
- case 'Gulim'
- plotlyFont = 'Balto, sans-serif';
- case 'GungSeo'
- plotlyFont = 'Old Standard TT, serif';
- case 'Gurmukhi MN'
- plotlyFont = 'PT Sans Narrow, sans-serif';
- case 'Gurmukhi MT'
- plotlyFont = 'PT Sans Narrow, sans-serif';
- case 'Haettenschweiler'
- plotlyFont = 'Arial, sans-serif';
- case 'Harrington'
- plotlyFont = 'Gravitas One, cursive';
- case 'HeadLineA'
- plotlyFont = 'Arial, sans-serif';
- case 'Hei'
- plotlyFont = 'Balto, sans-serif';
- case 'Heiti SC'
- plotlyFont = 'Balto, sans-serif';
- case 'Heiti TC'
- plotlyFont = 'Balto, sans-serif';
- case 'Helvetica'
- plotlyFont = 'Arial, sans-serif';
- case 'Helvetica CY'
- plotlyFont = 'Arial, sans-serif';
- case 'Helvetica Neue'
- plotlyFont = 'Arial, sans-serif';
- case 'Herculanum'
- plotlyFont = 'Gravitas One, cursive';
- case 'Hiragino Kaku Gothic Pro'
- plotlyFont = 'Balto, sans-serif';
- case 'Hiragino Kaku Gothic ProN'
- plotlyFont = 'Balto, sans-serif';
- case 'Hiragino Kaku Gothic Std'
- plotlyFont = 'Balto, sans-serif';
- case 'Hiragino Kaku Gothic StdN'
- plotlyFont = 'Balto, sans-serif';
- case 'Hiragino Maru Gothic Pro'
- plotlyFont = 'Balto, sans-serif';
- case 'Hiragino Maru Gothic ProN'
- plotlyFont = 'Balto, sans-serif';
- case 'Hiragino Mincho Pro'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Hiragino Mincho ProN'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Hiragino Sans GB'
- plotlyFont = 'Balto, sans-serif';
- case 'Hobo Std'
- plotlyFont = 'Droid Sans, sans-serif';
- case 'Hoefler Text'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Impact'
- plotlyFont = 'Arial, sans-serif';
- case 'Imprint MT Shadow'
- plotlyFont = 'Arial, sans-serif';
- case 'InaiMathi'
- plotlyFont = 'Balto, sans-serif';
- case 'Kai'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Kailasa'
- plotlyFont = 'Arial, sans-serif';
- case 'Kannada MN'
- plotlyFont = 'PT Sans Narrow, sans-serif';
- case 'Kannada Sangam MN'
- plotlyFont = 'Open Sans, sans-serif';
- case 'Kefa'
- plotlyFont = 'Arial, sans-serif';
- case 'Khmer MN'
- plotlyFont = 'Balto, sans-serif';
- case 'Khmer Sangam MN'
- plotlyFont = 'Balto, sans-serif';
- case 'Kino MT'
- plotlyFont = 'Old Standard TT, serif';
- case 'Kokonor'
- plotlyFont = 'Gravitas One, cursive';
- case 'Kozuka Gothic Pr6N'
- plotlyFont = 'Arial, sans-serif';
- case 'Kozuka Gothic Pro'
- plotlyFont = 'Arial, sans-serif';
- case 'Kozuka Mincho Pr6N'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Kozuka Mincho Pro'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Krungthep'
- plotlyFont = 'Arial, sans-serif';
- case 'KufiStandardGK'
- plotlyFont = 'Arial, sans-serif';
- case 'Lao MN'
- plotlyFont = 'PT Sans Narrow, sans-serif';
- case 'Lao Sangam MN'
- plotlyFont = 'Balto, sans-serif';
- case 'Letter Gothic Std'
- plotlyFont = 'Courier New, monospace';
- case 'LiHei Pro'
- plotlyFont = 'Arial, sans-serif';
- case 'LiSong Pro'
- plotlyFont = 'Courier New, monospace';
- case 'Lithos Pro'
- plotlyFont = 'Gravitas One, cursive';
- case 'Lucida Blackletter'
- plotlyFont = 'Gravitas One, cursive';
- case 'Lucida Bright'
- plorltFont = 'Gravitas One, cursive';
- case 'Lucida Calligraphy'
- plorltFont = 'Gravitas One, cursive';
- case 'Lucida Console'
- plotlyFont = 'Balto, sans-serif';
- case 'Lucida Fax'
- plotlyFont = 'Old Standard TT, serif';
- case 'Lucida Grande'
- plotlyFont = 'Balto, sans-serif';
- case 'Lucida Handwriting'
- plotlyFont = 'Gravitas One, cursive';
- case 'Lucida Sans'
- plotlyFont = 'Arial, sans-serif';
- case 'Lucida Sans Typewriter'
- plotlyFont = 'Arial, sans-serif';
- case 'Lucida Sans Unicode'
- plotlyFont = 'Balto, sans-serif';
- case 'Malayalam MN'
- plotlyFont = 'PT Sans Narrow, sans-serif';
- case 'Malayalam Sangam MN'
- plotlyFont = 'Balto, sans-serif';
- case 'Marker Felt'
- plotlyFont = 'Gravitas One, cursive';
- case 'Marlett'
- plotlyFont = 'Arial, sans-serif';
- case 'Matura MT Script Capitals'
- plotlyFont = 'Gravitas One, cursive';
- case 'Meiryo'
- plotlyFont = 'Balto, sans-serif';
- case 'Menlo'
- plotlyFont = 'Balto, sans-serif';
- case 'Mesquite Std'
- plotlyFont = 'Gravitas One, cursive';
- case 'Microsoft Sans Serif'
- plotlyFont = 'Open Sans, sans-serif';
- case 'Minion Pro'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Mistral'
- plotlyFont = 'Gravitas One, cursive';
- case 'Modern No. 20'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Monaco'
- plotlyFont = 'Arial, sans-serif';
- case 'Monospaced'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Monotype Corsiva'
- plotlyFont = 'Gravitas One, cursive';
- case 'Monotype Sorts'
- plotlyFont = 'Balto, sans-serif';
- case 'MS Gothic'
- plotlyFont = 'Balto, sans-serif';
- case 'MS Mincho'
- plotlyFont = 'Courier New, monospace';
- case 'MS PGothic'
- plotlyFont = 'Arial, sans-serif';
- case 'MS PMincho'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'MS Reference Sans Serif'
- plotlyFont = 'Arial, sans-serif';
- case 'MS Reference Specialty'
- plotlyFont = 'Balto, sans-serif';
- case 'Mshtakan'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'MT Extra'
- plotlyFont = 'Arial, sans-serif';
- case 'Myanmar MN'
- plotlyFont = 'PT Sans Narrow, sans-serif';
- case 'Myanmar Sangam MN'
- plotlyFont = 'Balto, sans-serif';
- case 'Myriad Pro'
- plotlyFont = 'Arial, sans-serif';
- case 'Nadeem'
- plotlyFont = 'Arial, sans-serif';
- case 'Nanum Brush Script'
- plotlyFont = 'Gravitas One, cursive';
- case 'Nanum Gothic'
- plotlyFont = 'Arial, sans-serif';
- case 'Nanum Myeongjo'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Nanum Pen Script'
- plotlyFont = 'Gravitas One, cursive';
- case 'New Peninim MT'
- plotlyFont = 'Gravitas One, cursive';
- case 'News Gothic MT'
- plotlyFont = 'Arial, sans-serif';
- case 'Noteworthy'
- plotlyFont = 'Gravitas One, cursive';
- case 'Nueva Std'
- plotlyFont = 'Gravitas One, cursive';
- case 'OCR A Std'
- plotlyFont = 'Old Standard TT, serif';
- case 'Onyx'
- plotlyFont = 'PT Sans Narrow, sans-serif';
- case 'Optima'
- plotlyFont = 'Droid Serif, serif';
- case 'Orator Std'
- plotlyFont = 'PT Sans Narrow, sans-serif';
- case 'Oriya MN'
- plotlyFont = 'PT Sans Narrow, sans-serif';
- case 'Oriya Sangam MN'
- plotlyFont = 'Balto, sans-serif';
- case 'Osaka'
- plotlyFont = 'Arial, sans-serif';
- case 'Palatino'
- plotlyFont = 'Old Standard TT, serif';
- case 'Palatino Linotype'
- plotlyFont = 'Old Standard TT, serif';
- case 'Papyrus'
- plotlyFont = 'Gravitas One, cursive';
- case 'PCMyungjo'
- plotlyFont = 'Courier New, monospace';
- case 'Perpetua'
- plotlyFont = 'Droid Serif, serif';
- case 'Perpetua Titling MT'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'PilGi'
- plotlyFont = 'Gravitas One, cursive';
- case 'Plantagenet Cherokee'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Playbill'
- plotlyFont = 'Arial, sans-serif';
- case 'PMingLiU'
- plotlyFont = 'Courier New, monospace';
- case 'Poplar Std'
- plotlyFont = 'Arial, sans-serif';
- case 'Prestige Elite Std'
- plotlyFont = 'Courier New, monospace';
- case 'PT Sans'
- plotlyFont = 'PT Sans Narrow, sans-serif';
- case 'PT Sans Caption'
- plotlyFont = 'Arial, sans-serif';
- case 'PT Sans Narrow'
- plotlyFont = 'PT Sans Narrow, sans-serif';
- case 'Raanana'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Rockwell'
- plotlyFont = 'Droid Serif, serif';
- case 'Rockwell Extra Bold'
- plotlyFont = 'Droid Serif, serif';
- case 'Rosewood Std'
- plotlyFont = 'Droid Serif, serif';
- case 'SansSerif'
- plotlyFont = 'Open Sans, sans-serif';
- case 'Sathu'
- plotlyFont = 'Arial, sans-serif';
- case 'Serif'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Silom'
- plotlyFont = 'Arial, sans-serif';
- case 'SimSun'
- plotlyFont = 'Courier New, monospace';
- case 'Sinhala MN'
- plotlyFont = 'Balto, sans-serif';
- case 'Sinhala Sangam MN'
- plotlyFont = 'Balto, sans-serif';
- case 'Skia'
- plotlyFont = 'Raleway, sans-serif';
- case 'Stencil'
- plotlyFont = 'Old Standard TT, serif';
- case 'Stencil Std'
- plotlyFont = 'Old Standard TT, serif';
- case 'STFangsong'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'STHeiti'
- plotlyFont = 'Balto, sans-serif';
- case 'STIXGeneral'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'STIXIntegralsD'
- plotlyFont = 'Arial, sans-serif';
- case 'STIXIntegralsSm'
- plotlyFont = 'Arial, sans-serif';
- case 'STIXIntegralsUp'
- plotlyFont = 'Arial, sans-serif';
- case 'STIXIntegralsUpD'
- plotlyFont = 'Arial, sans-serif';
- case 'STIXIntegralsUpSm'
- plotlyFont = 'Arial, sans-serif';
- case 'STIXNonUnicode'
- plotlyFont = 'Arial, sans-serif';
- case 'STIXSizeFiveSym'
- plotlyFont = 'Arial, sans-serif';
- case 'STIXSizeFourSym'
- plotlyFont = 'Arial, sans-serif';
- case 'STIXSizeOneSym'
- plotlyFont = 'Arial, sans-serif';
- case 'STIXSizeThreeSym'
- plotlyFont = 'Arial, sans-serif';
- case 'STIXSizeTwoSym'
- plotlyFont = 'Arial, sans-serif';
- case 'STIXVariants'
- plotlyFont = 'Arial, sans-serif';
- case 'STKaiti'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'STSong'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Symbol'
- plotlyFont = 'Open Sans, sans-serif';
- case 'Tahoma'
- plotlyFont = 'Arial, sans-serif';
- case 'Tamil MN'
- plotlyFont = 'PT Sans Narrow, sans-serif';
- case 'Tamil Sangam MN'
- plotlyFont = 'Balto, sans-serif';
- case 'Tekton Pro'
- plotlyFont = 'Gravitas One, cursive';
- case 'Telugu MN'
- plotlyFont = 'Arial, sans-serif';
- case 'Telugu Sangam MN'
- plotlyFont = 'Arial, sans-serif';
- case 'Thonburi'
- plotlyFont = 'Arial, sans-serif';
- case 'Times'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Times New Roman'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Trajan Pro'
- plotlyFont = 'Times New Roman, Times, serif';
- case 'Trebuchet MS'
- plotlyFont = 'Arial, sans-serif';
- case 'Tw Cen MT'
- plotlyFont = 'Balto, sans-serif';
- case 'Verdana'
- plotlyFont = 'Arial, sans-serif';
- case 'Webdings'
- plotlyFont = 'Arial, sans-serif';
- case 'Wide Latin'
- plotlyFont = 'Gravitas One, cursive';
- case 'Zapf Dingbats'
- plotlyFont = 'Open Sans, sans-serif';
- case 'Zapfino'
- plotlyFont = 'Gravitas One, cursive';
- otherwise
- plotlyFont = 'Open Sans, sans-serif';
+ try
+ % availableFont = {'Arial, sans-serif', 'Balto, sans-serif' , ...
+ % 'Courier New, monospace' , 'Droid Sans, sans-serif' ,...
+ % 'Droid Serif, serif', 'Droid Sans Mono, sans-serif', ...
+ % 'Georgia, serif' , 'Gravitas One, cursive' , ...
+ % 'Old Standard TT, serif' , 'Open Sans, sans-serif', ...
+ % 'PT Sans Narrow, sans-serif' , 'Raleway, sans-serif',...
+ % 'Times New Roman, Times, serif'};
+ switch matlabFont
+ case 'Abadi MT Condensed Extra Bold'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Abadi MT Condensed Light'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Adobe Arabic'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Adobe Caslon Pro'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Adobe Fan Heiti Std'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Adobe Fangsong Std'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Adobe Garamond Pro'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Adobe Gothic Std'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Adobe Hebrew'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Adobe Heiti Std'
+ plotlyFont = 'Droid Sans, sans-serif';
+ case 'Adobe Kaiti Std'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Adobe Ming Std'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Adobe Myungjo Std'
+ plotlyFont = 'Old Standard TT, serif';
+ case 'Adobe Song Std'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Al Bayan'
+ plotlyFont = 'Balto, sans-serif';
+ case 'American Typewriter'
+ plotlyFont = 'Old Standard TT, serif';
+ case 'Andale Mono'
+ plotlyFont = 'Droid Sans, sans-serif';
+ case 'Apple Braille'
+ plotlyFont = 'Balto, sans-serif';
+ case'le Chancery'
+ plotlyFont = 'Old Standard TT, serif';
+ case 'Apple Color Emoji'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Apple LiGothic'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Apple LiSung'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Apple Symbols'
+ plotlyFont = 'Balto, sans-serif';
+ case 'AppleGothic'
+ plotlyFont = 'Balto, sans-serif';
+ case 'AppleMyungjo'
+ plotlyFont = 'Old Standard TT, serif';
+ case 'Arial'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Arial Black'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Arial Hebrew'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Arial Narrow'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Arial Rounded MT Bold'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Arial Unicode MS'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Ayuthaya'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Baghdad'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Bangla MN'
+ plotlyFont ='Raleway, sans-serif';
+ case 'Bangla Sangam MN'
+ plotlyFont ='Raleway, sans-serif';
+ case 'Baskerville'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Baskerville Old Face'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Batang'
+ plotlyFont = 'Courier New, monospace';
+ case 'Bauhaus 93'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'Bell MT'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Bernard MT Condensed'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'BiauKai'
+ plotlyFont = 'Courier New, monospace';
+ case 'Big Caslon'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Birch Std'
+ plotlyFont = 'Droid Serif, serif';
+ case 'Blackoak Std'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'Book Antiqua'
+ plotlyFont = 'Droid Serif, serif';
+ case 'Bookman Old Style'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Bookshelf Symbol 7'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'Braggadocio'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'Britannic Bold'
+ plotlyFont = 'Courier New, monospace';
+ case 'Brush Script MT'
+ plotlyFont = 'Courier New, monospace';
+ case 'Brush Script Std'
+ plotlyFont = 'Courier New, monospace';
+ case 'Calibri'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Calisto MT'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Cambria'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Cambria Math'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Candara'
+ plotlyFont = 'Raleway, sans-serif';
+ case 'Century'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Century Gothic'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Century Schoolbook'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Chalkboard'
+ plotlyFont = 'Droid Sans, sans-serif';
+ case 'Chalkduster'
+ plotlyFont = 'Droid Sans, sans-serif';
+ case 'Chaparral Pro'
+ plotlyFont = 'Droid Serif, serif';
+ case 'Charcoal CY'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Charlemagne Std'
+ plotlyFont = 'Old Standard TT, serif';
+ case 'Cochin'
+ plotlyFont = 'Old Standard TT, serif';
+ case 'Colonna MT'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Comic Sans MS'
+ plotlyFont = 'Droid Sans, sans-serif';
+ case 'Consolas'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Constantia'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Cooper Black'
+ plotlyFont = 'Droid Sans, sans-serif';
+ case 'Cooper Std'
+ plotlyFont = 'Droid Sans, sans-serif';
+ case 'Copperplate'
+ plotlyFont = 'Old Standard TT, serif';
+ case 'Copperplate Gothic Bold'
+ plotlyFont = 'Old Standard TT, serif';
+ case 'Copperplate Gothic Light'
+ plotlyFont = 'Droid Serif, serif';
+ case 'Corbel'
+ plotlyFont = 'PT Sans Narrow, sans-serif';
+ case 'Corsiva Hebrew'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'Courier'
+ plotlyFont = 'Courier New, monospace';
+ case 'Courier New'
+ plotlyFont = 'Courier New, monospace';
+ case 'Curlz MT'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'Damascus'
+ plotlyFont = 'Arial, sans-serif';
+ case 'DecoType Naskh'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Desdemona'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'Devanagari MT'
+ plotlyFont = 'Old Standard TT, serif';
+ case 'Devanagari Sangam MN'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Dialog'
+ plotlyFont = 'Raleway, sans-serif';
+ case 'DialogInput'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Didot'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Edwardian Script ITC'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'Engravers MT'
+ plotlyFont = 'Droid Serif, serif';
+ case 'Euphemia UCAS'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Eurostile'
+ plotlyFont = 'Droid Sans, sans-serif';
+ case 'Footlight MT Light'
+ plotlyFont = 'Old Standard TT, serif';
+ case 'Franklin Gothic Book'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Franklin Gothic Medium'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Futura'
+ plotlyFont = 'Droid Sans, sans-serif';
+ case 'Gabriola'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'Garamond'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'GB18030 Bitmap'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Geeza Pro'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Geneva'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Geneva CY'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Georgia'
+ plotlyFont = 'Old Standard TT, serif';
+ case 'Giddyup Std'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'Gill Sans'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Gill Sans MT'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Gill Sans Ultra Bold'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Gloucester MT Extra Condensed'
+ plotlyFont = 'Droid Sans, sans-serif';
+ case 'Goudy Old Style'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Gujarati MT'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Gujarati Sangam MN'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Gulim'
+ plotlyFont = 'Balto, sans-serif';
+ case 'GungSeo'
+ plotlyFont = 'Old Standard TT, serif';
+ case 'Gurmukhi MN'
+ plotlyFont = 'PT Sans Narrow, sans-serif';
+ case 'Gurmukhi MT'
+ plotlyFont = 'PT Sans Narrow, sans-serif';
+ case 'Haettenschweiler'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Harrington'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'HeadLineA'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Hei'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Heiti SC'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Heiti TC'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Helvetica'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Helvetica CY'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Helvetica Neue'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Herculanum'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'Hiragino Kaku Gothic Pro'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Hiragino Kaku Gothic ProN'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Hiragino Kaku Gothic Std'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Hiragino Kaku Gothic StdN'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Hiragino Maru Gothic Pro'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Hiragino Maru Gothic ProN'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Hiragino Mincho Pro'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Hiragino Mincho ProN'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Hiragino Sans GB'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Hobo Std'
+ plotlyFont = 'Droid Sans, sans-serif';
+ case 'Hoefler Text'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Impact'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Imprint MT Shadow'
+ plotlyFont = 'Arial, sans-serif';
+ case 'InaiMathi'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Kai'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Kailasa'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Kannada MN'
+ plotlyFont = 'PT Sans Narrow, sans-serif';
+ case 'Kannada Sangam MN'
+ plotlyFont = 'Open Sans, sans-serif';
+ case 'Kefa'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Khmer MN'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Khmer Sangam MN'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Kino MT'
+ plotlyFont = 'Old Standard TT, serif';
+ case 'Kokonor'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'Kozuka Gothic Pr6N'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Kozuka Gothic Pro'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Kozuka Mincho Pr6N'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Kozuka Mincho Pro'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Krungthep'
+ plotlyFont = 'Arial, sans-serif';
+ case 'KufiStandardGK'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Lao MN'
+ plotlyFont = 'PT Sans Narrow, sans-serif';
+ case 'Lao Sangam MN'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Letter Gothic Std'
+ plotlyFont = 'Courier New, monospace';
+ case 'LiHei Pro'
+ plotlyFont = 'Arial, sans-serif';
+ case 'LiSong Pro'
+ plotlyFont = 'Courier New, monospace';
+ case 'Lithos Pro'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'Lucida Blackletter'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'Lucida Bright'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'Lucida Calligraphy'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'Lucida Console'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Lucida Fax'
+ plotlyFont = 'Old Standard TT, serif';
+ case 'Lucida Grande'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Lucida Handwriting'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'Lucida Sans'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Lucida Sans Typewriter'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Lucida Sans Unicode'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Malayalam MN'
+ plotlyFont = 'PT Sans Narrow, sans-serif';
+ case 'Malayalam Sangam MN'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Marker Felt'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'Marlett'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Matura MT Script Capitals'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'Meiryo'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Menlo'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Mesquite Std'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'Microsoft Sans Serif'
+ plotlyFont = 'Open Sans, sans-serif';
+ case 'Minion Pro'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Mistral'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'Modern No. 20'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Monaco'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Monospaced'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Monotype Corsiva'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'Monotype Sorts'
+ plotlyFont = 'Balto, sans-serif';
+ case 'MS Gothic'
+ plotlyFont = 'Balto, sans-serif';
+ case 'MS Mincho'
+ plotlyFont = 'Courier New, monospace';
+ case 'MS PGothic'
+ plotlyFont = 'Arial, sans-serif';
+ case 'MS PMincho'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'MS Reference Sans Serif'
+ plotlyFont = 'Arial, sans-serif';
+ case 'MS Reference Specialty'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Mshtakan'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'MT Extra'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Myanmar MN'
+ plotlyFont = 'PT Sans Narrow, sans-serif';
+ case 'Myanmar Sangam MN'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Myriad Pro'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Nadeem'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Nanum Brush Script'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'Nanum Gothic'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Nanum Myeongjo'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Nanum Pen Script'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'New Peninim MT'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'News Gothic MT'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Noteworthy'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'Nueva Std'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'OCR A Std'
+ plotlyFont = 'Old Standard TT, serif';
+ case 'Onyx'
+ plotlyFont = 'PT Sans Narrow, sans-serif';
+ case 'Optima'
+ plotlyFont = 'Droid Serif, serif';
+ case 'Orator Std'
+ plotlyFont = 'PT Sans Narrow, sans-serif';
+ case 'Oriya MN'
+ plotlyFont = 'PT Sans Narrow, sans-serif';
+ case 'Oriya Sangam MN'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Osaka'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Palatino'
+ plotlyFont = 'Old Standard TT, serif';
+ case 'Palatino Linotype'
+ plotlyFont = 'Old Standard TT, serif';
+ case 'Papyrus'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'PCMyungjo'
+ plotlyFont = 'Courier New, monospace';
+ case 'Perpetua'
+ plotlyFont = 'Droid Serif, serif';
+ case 'Perpetua Titling MT'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'PilGi'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'Plantagenet Cherokee'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Playbill'
+ plotlyFont = 'Arial, sans-serif';
+ case 'PMingLiU'
+ plotlyFont = 'Courier New, monospace';
+ case 'Poplar Std'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Prestige Elite Std'
+ plotlyFont = 'Courier New, monospace';
+ case 'PT Sans'
+ plotlyFont = 'PT Sans Narrow, sans-serif';
+ case 'PT Sans Caption'
+ plotlyFont = 'Arial, sans-serif';
+ case 'PT Sans Narrow'
+ plotlyFont = 'PT Sans Narrow, sans-serif';
+ case 'Raanana'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Rockwell'
+ plotlyFont = 'Droid Serif, serif';
+ case 'Rockwell Extra Bold'
+ plotlyFont = 'Droid Serif, serif';
+ case 'Rosewood Std'
+ plotlyFont = 'Droid Serif, serif';
+ case 'SansSerif'
+ plotlyFont = 'Open Sans, sans-serif';
+ case 'Sathu'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Serif'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Silom'
+ plotlyFont = 'Arial, sans-serif';
+ case 'SimSun'
+ plotlyFont = 'Courier New, monospace';
+ case 'Sinhala MN'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Sinhala Sangam MN'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Skia'
+ plotlyFont = 'Raleway, sans-serif';
+ case 'Stencil'
+ plotlyFont = 'Old Standard TT, serif';
+ case 'Stencil Std'
+ plotlyFont = 'Old Standard TT, serif';
+ case 'STFangsong'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'STHeiti'
+ plotlyFont = 'Balto, sans-serif';
+ case 'STIXGeneral'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'STIXIntegralsD'
+ plotlyFont = 'Arial, sans-serif';
+ case 'STIXIntegralsSm'
+ plotlyFont = 'Arial, sans-serif';
+ case 'STIXIntegralsUp'
+ plotlyFont = 'Arial, sans-serif';
+ case 'STIXIntegralsUpD'
+ plotlyFont = 'Arial, sans-serif';
+ case 'STIXIntegralsUpSm'
+ plotlyFont = 'Arial, sans-serif';
+ case 'STIXNonUnicode'
+ plotlyFont = 'Arial, sans-serif';
+ case 'STIXSizeFiveSym'
+ plotlyFont = 'Arial, sans-serif';
+ case 'STIXSizeFourSym'
+ plotlyFont = 'Arial, sans-serif';
+ case 'STIXSizeOneSym'
+ plotlyFont = 'Arial, sans-serif';
+ case 'STIXSizeThreeSym'
+ plotlyFont = 'Arial, sans-serif';
+ case 'STIXSizeTwoSym'
+ plotlyFont = 'Arial, sans-serif';
+ case 'STIXVariants'
+ plotlyFont = 'Arial, sans-serif';
+ case 'STKaiti'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'STSong'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Symbol'
+ plotlyFont = 'Open Sans, sans-serif';
+ case 'Tahoma'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Tamil MN'
+ plotlyFont = 'PT Sans Narrow, sans-serif';
+ case 'Tamil Sangam MN'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Tekton Pro'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'Telugu MN'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Telugu Sangam MN'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Thonburi'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Times'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Times New Roman'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Trajan Pro'
+ plotlyFont = 'Times New Roman, Times, serif';
+ case 'Trebuchet MS'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Tw Cen MT'
+ plotlyFont = 'Balto, sans-serif';
+ case 'Verdana'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Webdings'
+ plotlyFont = 'Arial, sans-serif';
+ case 'Wide Latin'
+ plotlyFont = 'Gravitas One, cursive';
+ case 'Zapf Dingbats'
+ plotlyFont = 'Open Sans, sans-serif';
+ case 'Zapfino'
+ plotlyFont = 'Gravitas One, cursive';
+ otherwise
+ plotlyFont = 'Open Sans, sans-serif';
+ end
+ catch
+ display(['We had trouble identifying the font of your text. ', ...
+ 'Please see https://plot.ly/matlab for more information.']);
end
-catch
- display(['We had trouble identifying the font of your text. Please see',...
- 'https://plot.ly/matlab for more information.']);
-end
\ No newline at end of file
+end
diff --git a/plotly/plotlyfig_aux/helpers/openurl.m b/plotly/plotlyfig_aux/helpers/openurl.m
index cf2b1a3a..317fbdb6 100644
--- a/plotly/plotlyfig_aux/helpers/openurl.m
+++ b/plotly/plotlyfig_aux/helpers/openurl.m
@@ -1,9 +1,11 @@
function openurl(url)
-try
- desktop = com.mathworks.mde.desk.MLDesktop.getInstance;
- editor = desktop.getGroupContainer('Editor');
- if(~isempty(url) && ~isempty(editor));
- fprintf(['\nLet''s have a look: ' url '\n\n'], url)
+ try
+ desktop = com.mathworks.mde.desk.MLDesktop.getInstance;
+ editor = desktop.getGroupContainer('Editor');
+ if (~isempty(url) && ~isempty(editor))
+ fprintf(['\nLet''s have a look: ' ...
+ '' url ...
+ '\n\n'], url)
+ end
end
-end
end
\ No newline at end of file
diff --git a/plotly/plotlyfig_aux/helpers/parseString.m b/plotly/plotlyfig_aux/helpers/parseString.m
index 56875eb9..0023b19b 100644
--- a/plotly/plotlyfig_aux/helpers/parseString.m
+++ b/plotly/plotlyfig_aux/helpers/parseString.m
@@ -1,42 +1,45 @@
function formatStr = parseString(inputStr,interpreter)
+ % parseLatex(inputStr,d) converts TeX, and LaTeX
+ % strings into a format that preserves the text/math
+ % formatting structure used by mathjax for Plotly plots.
+ %
+ % TeX: parses through inputStr for instances of
+ % the specials characters: \, _, and ^. Uses whitespace
+ % as a delimter for the end of \reservedwords (enforced
+ % if not already present), uses either the enclosing { }
+ % brackets as delimeters for _ and ^ or simply the
+ % immediately proceeding character if no curly brackets
+ % are present. If the immediately proceeding character
+ % of ^ or _ is a \reservedword, the entire word up to the
+ % next whitespace is taken. All other characters are
+ % contained within \text{ } blocks. Resulting string is
+ % placed within inline: formatStr = $ ...parsedStr... $ delimeters.
+ %
+ % LaTeX: parses through inputStr for instances of $
+ % or $$. Assumes that $/$$ are only ever used as
+ % delimiters. Anything chars that do not fall within the
+ % $/$ or $$/$$ blocks are placed within a \text{ } block.
+ % Finally, all instances of $/$$ are removed and the
+ % resulting string is placed (if no $$ instance is present)
+ % within inline: formatStr = $ ...parsedStr...$ delimeters
+ % or (if an instance of $$ is present) wihtin block:
+ % formatStr $$... parsedStr ... $$ delimeters.
-% parseLatex(inputStr,d) converts TeX, and LaTeX
-% strings into a format that preserves the text/math
-% formatting structure used by mathjax for Plotly plots.
-%
-% TeX: parses through inputStr for instances of
-% the specials characters: \, _, and ^. Uses whitespace
-% as a delimter for the end of \reservedwords (enforced
-% if not already present), uses either the enclosing { }
-% brackets as delimeters for _ and ^ or simply the
-% immediately proceeding character if no curly brackets
-% are present. If the immediately proceeding character
-% of ^ or _ is a \reservedword, the entire word up to the
-% next whitespace is taken. All other characters are
-% contained within \text{ } blocks. Resulting string is
-% placed within inline: formatStr = $ ...parsedStr... $ delimeters.
-%
-% LaTeX: parses through inputStr for instances of $
-% or $$. Assumes that $/$$ are only ever used as
-% delimiters. Anything chars that do not fall within the
-% $/$ or $$/$$ blocks are placed within a \text{ } block.
-% Finally, all instances of $/$$ are removed and the
-% resulting string is placed (if no $$ instance is present)
-% within inline: formatStr = $ ...parsedStr...$ delimeters
-% or (if an instance of $$ is present) wihtin block:
-% formatStr $$... parsedStr ... $$ delimeters.
+ %initialize output
+ formatStr = inputStr;
-%initialize output
-formatStr = inputStr;
+ if isempty(inputStr)
+ formatStr = 'untitled';
+ return
+ end
-if ~isempty(inputStr)
try
istex = false;
islatex = false;
%------- CONVERT CELL ARRAY TO STRING WITH LINE BREAKS -------%
- if(iscell(inputStr))
- if(size(inputStr,1)==1)
+ if (iscell(inputStr))
+ if (size(inputStr,1)==1)
inputStr = strjoin(inputStr, '
');
else
inputStr = strjoin(inputStr', '
');
@@ -45,48 +48,40 @@
%------- PARSE TEX --------%
- if(strcmp(interpreter,'tex'));
-
+ if (strcmp(interpreter,'tex'))
%add white space after reserved TeX words
formatStr = formatRW(inputStr);
%counter to iterate through formatStr
scount = 1;
%counter to iterate through formatStrCell
ccount = 1;
-
%iterate through formatStr
while scount <= (length(formatStr))
switch formatStr(scount)
-
- %- \words - %
-
- case '\'
+ case '\' %- \words - %
istex = true;
formatStrCell{ccount} = [];
while(scount <= length(formatStr))
formatStrCell{ccount} = [formatStrCell{ccount} formatStr(scount)];
%break \word structure at whitespace: ' '
- if(strcmp(formatStr(scount),' '))
+ if (strcmp(formatStr(scount),' '))
scount = scount + 1;
break
end
scount = scount + 1;
end
ccount = ccount + 1;
-
- %- _ subscripts -%
-
- case '_'
+ case '_' %- _ subscripts -%
istex = true;
formatStrCell{ccount} = [];
% look for enclosing { }
- if(~strcmp(formatStr(scount+1),'{'))
+ if (~strcmp(formatStr(scount+1),'{'))
% if no { } look for \ word
- if(strcmp(formatStr(scount+1),'\'))
+ if (strcmp(formatStr(scount+1),'\'))
while (scount <= length(formatStr))
formatStrCell{ccount} = [formatStrCell{ccount} formatStr(scount)];
% break \word structure at whitespace: ' '
- if(strcmp(formatStr(scount), ' '))
+ if (strcmp(formatStr(scount), ' '))
scount = scount + 1;
break
end
@@ -105,7 +100,7 @@
while (scount <= length(formatStr))
formatStrCell{ccount} = [formatStrCell{ccount} formatStr(scount)];
% break _{ structure at '}'
- if(strcmp(formatStr(scount), '}'))
+ if (strcmp(formatStr(scount), '}'))
scount = scount + 1;
break
end
@@ -113,20 +108,17 @@
end
ccount = ccount + 1;
end
-
- %- ^ superscripts - %
-
- case '^'
+ case '^' %- ^ superscripts - %
istex = true;
formatStrCell{ccount} = [];
% look for enclosing { }
- if(~strcmp(formatStr(scount+1),'{'))
+ if (~strcmp(formatStr(scount+1),'{'))
% if no { } look for \ word
- if(strcmp(formatStr(scount+1),'\'))
+ if (strcmp(formatStr(scount+1),'\'))
while ((scount <= length(formatStr)))
formatStrCell{ccount} = [formatStrCell{ccount} formatStr(scount)];
% break \word structure at whitespace: ' '
- if(strcmp(formatStr(scount), ' '))
+ if (strcmp(formatStr(scount), ' '))
scount = scount + 1;
break
end
@@ -145,7 +137,7 @@
while ((scount <= length(formatStr)))
formatStrCell{ccount} = [formatStrCell{ccount} formatStr(scount)];
% break ^{ structure at '}'
- if(strcmp(formatStr(scount), '}'))
+ if (strcmp(formatStr(scount), '}'))
scount = scount + 1;
break
end
@@ -153,14 +145,13 @@
end
ccount = ccount + 1;
end
-
- %- \text{ } - %
-
- otherwise
+ otherwise %- \text{ } - %
formatStrCell{ccount} = ['\text{'];
while (scount <= length(formatStr))
%break \text{ } structure at \word, _ or ^ chars
- if(strcmp(formatStr(scount), '_') || strcmp(formatStr(scount), '^') || strcmp(formatStr(scount), '\') )
+ if (strcmp(formatStr(scount), '_') ...
+ || strcmp(formatStr(scount), '^') ...
+ || strcmp(formatStr(scount), '\') )
break
end
formatStrCell{ccount} = [formatStrCell{ccount} formatStr(scount)];
@@ -170,21 +161,16 @@
ccount = ccount + 1;
end
end
-
%created parsedStr from formatStrCell
parsedStr = [ formatStrCell{:} ];
% place in inline: $...parsedStr...$ delimiters
- if(istex)
+ if (istex)
formatStr = ['$' parsedStr '$'];
else
formatStr = inputStr;
end
-
- %------- PARSE LATEX --------%
-
- elseif(strcmp(interpreter,'latex'));
-
+ elseif (strcmp(interpreter,'latex')) %------- PARSE LATEX --------%
formatStr = inputStr;
%counter to iterate through formatStr
scount = 1;
@@ -195,17 +181,16 @@
%iterate through formatStr
while scount <= (length(formatStr))
-
- if(strcmp(formatStr(scount),'$'))
+ if (strcmp(formatStr(scount),'$'))
islatex = true;
-
+
%- $$... $$ -%
if any(dsPairs == scount)
nextS = regexp(formatStr(scount+1:end),'\$\$','once');
formatStrCell{ccount} = formatStr(scount:scount + nextS);
scount = scount + nextS + 2;
ccount = ccount + 1;
-
+
%- $ ... $ -%
else
nextS = regexp(formatStr(scount+1:end),'\$','once');
@@ -213,13 +198,10 @@
scount = scount + nextS + 1;
ccount = ccount + 1;
end
-
- %- \text{ } -%
-
- else
+ else %- \text{ } -%
formatStrCell{ccount} = ['\text{'];
while(scount<= length(formatStr))
- if(strcmp(formatStr(scount),'$'))
+ if (strcmp(formatStr(scount),'$'))
break
end
formatStrCell{ccount} = [formatStrCell{ccount} formatStr(scount)];
@@ -229,15 +211,15 @@
ccount = ccount + 1;
end
end
-
+
%remove all instances of $
parsedStr = [formatStrCell{:}];
parsedStr(regexp(parsedStr,'\$')) = '';
-
+
% place in inline: $...parsedStr...$
% or $$...parsedStr...$$ delimiters
- if(islatex)
- if(any(dsPairs))
+ if (islatex)
+ if (any(dsPairs))
formatStr = ['$$' parsedStr '$$'];
else
formatStr = ['$' parsedStr '$'];
@@ -247,13 +229,4 @@
end
end
end
-else
- formatStr = 'untitled';
end
-
-
-
-
-
-
-
diff --git a/plotly/plotlyfig_aux/helpers/plotlymsg.m b/plotly/plotlyfig_aux/helpers/plotlymsg.m
index 2cd92d8d..ae7489b7 100644
--- a/plotly/plotlyfig_aux/helpers/plotlymsg.m
+++ b/plotly/plotlyfig_aux/helpers/plotlymsg.m
@@ -1,18 +1,27 @@
function errormsg = plotlymsg(key)
-switch key
- %--plotlyfig constructor--%
- case 'plotlyfigConstructor:notSignedIn'
- errormsg = '\nOops! You must be signed in to initialize a plotlyfig object.\n';
- case 'plotlyfigConstructor:invalidInputs'
- errormsg = ['\nOops! It appears that you did not initialize the plotlyfig object using the\n', ...
- 'required: >> plotlyfig(handle [optional],''property'',''value'',...) \n',...
- 'input structure. Please try again or post a topic on https://community.plotly.com/c/api/matlab/ for any additional help!\n\n'];
- %--saveplotlyfig invocation--%;
- case 'plotlySaveImage:invalidInputs'
- errormsg = ['\nOops! It appears that you did not invoke the saveplotlyfig function using the\n', ...
- 'required: >> saveplotlyfig(plotly_figure, ...) input structure, where plotly_figure\n',...
- 'is of type cell (for data traces) or of type struct (with data and layout fields). \n',...
- 'Please try again or post a topic on https://community.plotly.com/c/api/matlab/ for any additional help!\n\n'];
-
-end
+ switch key
+ %--plotlyfig constructor--%
+ case 'plotlyfigConstructor:notSignedIn'
+ errormsg = ['\nOops! You must be signed in to initialize ' ...
+ 'a plotlyfig object.\n'];
+ case 'plotlyfigConstructor:invalidInputs'
+ errormsg = ['\nOops! It appears that you did not ' ...
+ 'initialize the plotlyfig object using the\n', ...
+ 'required: >> plotlyfig(handle ', ...
+ '[optional],''property'',''value'',...) \ninput ' ...
+ 'structure. Please try again or post a topic on ' ...
+ 'https://community.plotly.com/c/api/matlab/ for ' ...
+ 'any additional help!\n\n'];
+ %--saveplotlyfig invocation--%;
+ case 'plotlySaveImage:invalidInputs'
+ errormsg = ['\nOops! It appears that you did not invoke ' ...
+ 'the saveplotlyfig function using the\nrequired: ' ...
+ '>> saveplotlyfig(plotly_figure, ...) input ' ...
+ 'structure, where plotly_figure\nis of type cell ' ...
+ '(for data traces) or of type struct (with data ' ...
+ 'and layout fields). \nPlease try again or post a ' ...
+ 'topic on ' ...
+ 'https://community.plotly.com/c/api/matlab/ for ' ...
+ 'any additional help!\n\n'];
+ end
end
diff --git a/plotly/plotlyhelp.m b/plotly/plotlyhelp.m
index 40512815..076b8828 100644
--- a/plotly/plotlyhelp.m
+++ b/plotly/plotlyhelp.m
@@ -1,31 +1,31 @@
function plotlyref = plotlyhelp(varargin)
-% [EX]: plotlyhelp('scatter','fill');
+ % [EX]: plotlyhelp('scatter','fill');
-%converts graph_obj_meta.json to struct/cell array and outputs key
-plotlyref = load('plotly_reference.mat');
-pr = plotlyref.pr;
-pr.online = 'Access the online docs!';
+ %converts graph_obj_meta.json to struct/cell array and outputs key
+ plotlyref = load('plotly_reference.mat');
+ pr = plotlyref.pr;
+ pr.online = 'Access the online docs!';
-try
- switch length(varargin)
- case 0
- plotlyref = pr;
- case 1
- if(strcmpi('online',varargin{1}));
- web('http://plot.ly/matlab/','-browser')
- else
- plotlyref = pr.(lower(varargin{1}));
- end
- case 2
- plotlyref = pr.(lower(varargin{1})).(lower(varargin{2}));
- case 3
- plotlyref = pr.(lower(varargin{1})).(lower(varargin{2})).(lower(varargin{3}));
- case 4 %does the struct nesting ever go beyond 4?
- plotlyref = pr.(lower(varargin{1})).(lower(varargin{2})).(lower(varargin{3})).(lower(varargin{4}));
+ try
+ switch length(varargin)
+ case 0
+ plotlyref = pr;
+ case 1
+ if (strcmpi('online', varargin{1}));
+ web('http://plot.ly/matlab/','-browser')
+ else
+ plotlyref = pr.(lower(varargin{1}));
+ end
+ case 2
+ plotlyref = pr.(lower(varargin{1})).(lower(varargin{2}));
+ case 3
+ plotlyref = pr.(lower(varargin{1})).(lower(varargin{2})).(lower(varargin{3}));
+ case 4 %does the struct nesting ever go beyond 4?
+ plotlyref = pr.(lower(varargin{1})).(lower(varargin{2})).(lower(varargin{3})).(lower(varargin{4}));
+ end
+
+ catch exception
+ fprintf(['\n\nSorry! We could not find what you were looking ' ...
+ 'for. Please specify a valid Plotly reference.\n\n']);
end
-
-catch exception
- fprintf('\n\nSorry! We could not find what you were looking for. Please specify a valid Plotly reference.\n\n');
-end
-
end
diff --git a/plotly/plotlystream.m b/plotly/plotlystream.m
index 0a7bd54e..29994cca 100644
--- a/plotly/plotlystream.m
+++ b/plotly/plotlystream.m
@@ -75,13 +75,9 @@
%check for correct input structure
if nargin > 0
-
if ischar(request)
-
obj.Specs.Token = request;
-
elseif isstruct(request)
-
%check for tokens (required)
if (isfield(request,'token'))
obj.Specs.Token = request.token;
@@ -90,19 +86,15 @@
'online documentation found @ plot.ly/matlab for more information or contact ',...
'chuck@plot.ly']);
end
-
if isfield(request,'host')
obj.Specs.Host = request.host;
end
-
if isfield(request,'timeout')
obj.Specs.Timeout = request.timeout;
end
-
if isfield(request,'handler')
obj.Specs.Handler= request.handler;
end
-
if isfield(request,'chunklen')
obj.Specs.Chunklen= request.chunklen;
end
@@ -112,7 +104,6 @@
'Please check out the online documentation found @ plot.ly/matlab ',...
'for more information or contact chuck@plot.ly']);
end
-
else
error(['Oops! You did not properly specify a stream token! Please check out the ', ....
'online documentation found @ plot.ly/matlab for more information or contact ',...
@@ -122,9 +113,7 @@
%-----------OPEN STREAM-----------%
function obj = open(obj)
-
try obj.connect;
-
%Connection successful!
fprintf('\n[Connection Successful]\n\n');
@@ -133,7 +122,6 @@
obj.Specs.Closed = false;
catch ME
-
error(['Oops! The following error occured when trying to write to the stream: ',...
ME.message '. Please check the online documentation ', ...
'found @ plot.ly/matlab for more information or contact chuck@plot.ly']);
@@ -167,7 +155,6 @@
%-----------WRITE STREAM-----------%
function obj = write(obj,request)
-
if nargin ~= 2
error(['Oops! It appears that not enough input arguments were ',...
'specified to the write method of your plotlystream object. ',...
@@ -184,19 +171,17 @@
body = request;
%make sure we did not close the stream
- if(~obj.Specs.Closed)
+ if (~obj.Specs.Closed)
try
%write to stream
obj.Stream.write(unicode2native(sprintf([m2json(body) '\n']),''));
catch ME
-
%error due to stream not being open (creation of Stream object)
- if(strcmp(ME.message, 'Attempt to reference field of non-structure array.'))
+ if strcmp(ME.message, 'Attempt to reference field of non-structure array.')
error(['Oops! A connection has not yet been established. Please open',...
' a connection by firsting calling the ''open'' method of your',...
' plotlystream object.']);
else
-
%---reconnect---%
obj.getresponse;
if any(strcmp(obj.Specs.ReconnectOn,obj.Response))
@@ -231,7 +216,7 @@
try
obj.Stream.close;
catch ME
- if(strcmp(ME.message, 'Attempt to reference field of non-structure array.'))
+ if (strcmp(ME.message, 'Attempt to reference field of non-structure array.'))
error(['Oops! A connection has not yet been established. Please open',...
' a connection by firsting calling the ''open'' method of your',...
' plotlystream object.']);
@@ -257,7 +242,7 @@
obj.resetretries;
obj.Specs.Closed = false;
catch
- if(obj.Specs.ConnectAttempts <= obj.Specs.MaxConnectAttempts)
+ if (obj.Specs.ConnectAttempts <= obj.Specs.MaxConnectAttempts)
fprintf(['\n[Connection Failed] Attempt:' num2str(obj.Specs.ConnectAttempts) ' to reconnect...'])
pause(obj.Specs.ConnectDelay);
obj.Specs.ConnectDelay = 2*obj.Specs.ConnectDelay; %delay grows by factor of 2
@@ -276,7 +261,7 @@
try
obj.Response = num2str(obj.Connection.getResponseCode);
catch ME
- if(strcmp(ME.message, 'Attempt to reference field of non-structure array.'))
+ if (strcmp(ME.message, 'Attempt to reference field of non-structure array.'))
error(['Oops! A connection has not yet been established. Please open',...
' a connection by firsting calling the ''open'' method of your',...
' plotlystream object.']);
@@ -290,7 +275,6 @@
obj.Specs.ConnectAttempts = 0;
obj.Specs.ConnectDelay = 1;
end
-
end
end
diff --git a/plotly/plotlystream_aux/plotlystream_demo.m b/plotly/plotlystream_aux/plotlystream_demo.m
index d1db2d16..faacbad0 100644
--- a/plotly/plotlystream_aux/plotlystream_demo.m
+++ b/plotly/plotlystream_aux/plotlystream_demo.m
@@ -46,4 +46,3 @@
%----CLOSE THE STREAM----%
ps.close;
-
diff --git a/plotly/saveplotlyfig.m b/plotly/saveplotlyfig.m
index fcbd0ca1..785e7ba2 100644
--- a/plotly/saveplotlyfig.m
+++ b/plotly/saveplotlyfig.m
@@ -1,72 +1,67 @@
function p = saveplotlyfig(figure_or_data, filename, varargin)
-
-%-----------------------------SAVEPLOTLYFIG-------------------------------%
-
-% Save a MATLAB figure as a static image using Plotly
-
-% [CALL]:
-
-% p = saveplotlyfig(figure, filename)
-% p = saveplotlyfig(data, filename)
-% p = saveplotlyfig(figure, filename, varargin)
-% p = saveplotlyfig(data, filename, varargin)
-
-% [INPUTS]: [TYPE]{default} - description/'options'
-
-% figure: [structure array]{} - structure with 'data' and 'layout' fields
-% or
-% figure: [plotlyfig object]{} - plotlyfig object with data and layout properties
-% or
-% figure: [figure handle]{} - figure handle
-% data: [cell array]{} - cell array of Plotly traces
-% varargin: [string]{.png} - image extension ('png','jpeg','pdf','svg')
-
-% [OUTPUT]:
-
-% static image save to the directory specified within the filename with the
-% extension specified within filename or varargin.
-
-% [EXAMPLE]:
-
-% data.type = 'scatter';
-% data.x = 1:10;
-% data.y = 1:10;
-% saveplotlyfig(data,'myimage.jpeg');
-
-% [ADDITIONAL RESOURCES]:
-
-% For full documentation and examples, see https://plot.ly/matlab/static-image-export/
-
-%-------------------------------------------------------------------------%
-
-%--PARSE FIGURE_OR_DATA--%
-if iscell(figure_or_data)
- p = plotlyfig('Visible','off');
- p.data = figure_or_data;
- p.layout = struct();
- p.PlotOptions.Strip = false;
-elseif isstruct(figure_or_data);
- p = plotlyfig('Visible','off');
- p.data = figure_or_data.data;
- p.layout = figure_or_data.layout;
- p.PlotOptions.Strip = false;
-elseif isa(figure_or_data, 'plotlyfig')
- p = figure_or_data;
- p.PlotOptions.Strip = false;
-elseif ishandle(figure_or_data)
- if strcmp(handle(figure_or_data).classhandle.name,'figure')
- p = plotlyfig(figure_or_data, 'strip', false);
+ %-----------------------------SAVEPLOTLYFIG---------------------------%
+
+ % Save a MATLAB figure as a static image using Plotly
+
+ % [CALL]:
+
+ % p = saveplotlyfig(figure, filename)
+ % p = saveplotlyfig(data, filename)
+ % p = saveplotlyfig(figure, filename, varargin)
+ % p = saveplotlyfig(data, filename, varargin)
+
+ % [INPUTS]: [TYPE]{default} - description/'options'
+
+ % figure: [structure array]{} - structure with 'data' and 'layout' fields
+ % or
+ % figure: [plotlyfig object]{} - plotlyfig object with data and layout properties
+ % or
+ % figure: [figure handle]{} - figure handle
+ % data: [cell array]{} - cell array of Plotly traces
+ % varargin: [string]{.png} - image extension ('png','jpeg','pdf','svg')
+
+ % [OUTPUT]:
+
+ % static image save to the directory specified within the filename with the
+ % extension specified within filename or varargin.
+
+ % [EXAMPLE]:
+
+ % data.type = 'scatter';
+ % data.x = 1:10;
+ % data.y = 1:10;
+ % saveplotlyfig(data,'myimage.jpeg');
+
+ % [ADDITIONAL RESOURCES]:
+
+ % For full documentation and examples, see
+ % https://plot.ly/matlab/static-image-export/
+
+ %---------------------------------------------------------------------%
+
+ %--PARSE FIGURE_OR_DATA--%
+ if iscell(figure_or_data)
+ p = plotlyfig('Visible','off');
+ p.data = figure_or_data;
+ p.layout = struct();
+ p.PlotOptions.Strip = false;
+ elseif isstruct(figure_or_data);
+ p = plotlyfig('Visible','off');
+ p.data = figure_or_data.data;
+ p.layout = figure_or_data.layout;
+ p.PlotOptions.Strip = false;
+ elseif isa(figure_or_data, 'plotlyfig')
+ p = figure_or_data;
+ p.PlotOptions.Strip = false;
+ elseif ishandle(figure_or_data)
+ if strcmp(handle(figure_or_data).classhandle.name,'figure')
+ p = plotlyfig(figure_or_data, 'strip', false);
+ end
+ else
+ errkey = 'plotlySaveImage:invalidInputs';
+ error(errkey,plotlymsg(errkey));
end
-else
- errkey = 'plotlySaveImage:invalidInputs';
- error(errkey,plotlymsg(errkey));
-end
-
-%-------------------------------------------------------------------------%
-
-%--MAKE CALL TO SAVEAS METHOD--%
-p.saveas(filename, varargin{:});
-
-%-------------------------------------------------------------------------%
+ %--MAKE CALL TO SAVEAS METHOD--%
+ p.saveas(filename, varargin{:});
end
diff --git a/plotlysetup_offline.m b/plotlysetup_offline.m
index cbf1d370..08bb5ab2 100644
--- a/plotlysetup_offline.m
+++ b/plotlysetup_offline.m
@@ -1,5 +1,4 @@
function plotlysetup_offline(plotly_bundle_url, varargin)
-
% CALL: plotlysetup_offline(plotly_bundle_url);
% WHERE: plotly_bundle_url is the plotly bundle url, e.g. http://cdn.plot.ly/plotly-latest.min.js
% If no argument is provided, the default http://cdn.plot.ly/plotly-latest.min.js is used.
@@ -11,9 +10,9 @@ function plotlysetup_offline(plotly_bundle_url, varargin)
exception.identifier = '';
try %check number of inputs
- if(nargin == 0)
+ if nargin == 0
plotly_bundle_url = 'http://cdn.plot.ly/plotly-latest.min.js';
- elseif (nargin>1)
+ elseif nargin>1
error('plotly:wrongInput',....
['\n\nWhoops! Wrong number of inputs. Please run >> help plotlysetup_offline \n',...
'for more information regarding the setup your Plotly API MATLAB \n',...
@@ -42,8 +41,7 @@ function plotlysetup_offline(plotly_bundle_url, varargin)
return
end
- if(~is_octave)
-
+ if ~is_octave
try
%embed the api to the matlabroot/toolbox dir.
fprintf('\nAdding Plotly to MATLAB toolbox directory ... ');
@@ -51,20 +49,19 @@ function plotlysetup_offline(plotly_bundle_url, varargin)
%plotly folder in the matlab/toolbox dir.
plotlyToolboxPath = fullfile(matlabroot,'toolbox','plotly');
- if(exist(plotlyToolboxPath,'dir')) %check for overwrite...
+ if exist(plotlyToolboxPath,'dir') %check for overwrite...
fprintf(['\n\n[UPDATE]: \n\nHey! We see that a copy of Plotly has previously been added to\n' ...
'your Matlab toolboxes. Would you like us to overwrite it with:\n' plotlyFolderPath ' ? \n'...
'Careful! You may lose data saved to this Plotly directory.\n\n']);
overwrite = input('Overwrite (y/n) ? : ','s');
- if(strcmpi(overwrite,'y'));
+ if (strcmpi(overwrite,'y'));
fprintf('\n[OVERWRITE]:\n\nOverwriting Plotly! ... Done \n');
else
fprintf('\n[NO OVERWRITE]:\n\nDid not overwrite Plotly! ... Done \n');
end
else %toolbox Plotly not yet created
-
%worked (without interuption)...just a formatting thing!
fprintf('Done\n');
@@ -80,13 +77,12 @@ function plotlysetup_offline(plotly_bundle_url, varargin)
end
end
- if(strcmpi(overwrite,'y'))
-
+ if strcmpi(overwrite,'y')
%move a copy of the Plotly api to matlab root directory
[status, msg, messid] = copyfile(plotlyFolderPath,plotlyToolboxPath);
%check that the plotly api was copied to the matlab root toolbox directory
if (status == 0)
- if(~strcmp(messid, 'MATLAB:COPYFILE:SourceAndDestinationSame'))
+ if (~strcmp(messid, 'MATLAB:COPYFILE:SourceAndDestinationSame'))
error('plotly:copyPlotly',permissionMessage('copy the Plotly folder'));
end
end
@@ -102,10 +98,10 @@ function plotlysetup_offline(plotly_bundle_url, varargin)
%check for a startup.m file in matlab rootpath (we want to add one here)
startupFile = [];
startupFileRootPath = fullfile(matlabroot,'toolbox','local','startup.m');
- if(~exist(startupFileRootPath,'file'))
+ if ~exist(startupFileRootPath,'file')
startFileID = fopen(startupFileRootPath, 'w');
%startup.m does not exist and startupFilePath is non-writable
- if(startFileID == -1)
+ if (startFileID == -1)
error('plotly:rootStartupCreation',permissionMessage('write the startup.m script'));
end
startupFile = {startupFileRootPath}; %needed because MATLAB only looks for startup.m when first opened.
@@ -121,7 +117,7 @@ function plotlysetup_offline(plotly_bundle_url, varargin)
%print any addplotlydstatup warnings;
w = cellfun(@isempty,warnings);
- if(find(~w))
+ if find(~w)
%output warnings
exception.warnings = warnings;
fprintf(warnings{find(~w)});
@@ -141,17 +137,14 @@ function plotlysetup_offline(plotly_bundle_url, varargin)
%greet the people!
fprintf('\nWelcome to Plotly! If you are new to Plotly please enter: >> plotlyhelp to get started!\n\n')
-
- end
-
- %helper message function
- function message = permissionMessage(spec)
+end
+
+% helper message function
+function message = permissionMessage(spec)
message = ['\n\nShoot! We tried to ' spec ' to the MATLAB toolbox \n',...
- 'directory, but were denied write permission. You''ll have to add\n',...
- 'the Plotly folder to your MATLAB path manually by running: \n\n',...
- '>> plotly_path = fullfile(pwd, ''plotly'')\n',...
- '>> addpath(genpath(plotly_path))\n\n',...
- 'Questions? Ask https://community.plotly.com/c/api/matlab/\n\n'];
- end
-
-
+ 'directory, but were denied write permission. You''ll have to add\n',...
+ 'the Plotly folder to your MATLAB path manually by running: \n\n',...
+ '>> plotly_path = fullfile(pwd, ''plotly'')\n',...
+ '>> addpath(genpath(plotly_path))\n\n',...
+ 'Questions? Ask https://community.plotly.com/c/api/matlab/\n\n'];
+end
diff --git a/plotlysetup_online.m b/plotlysetup_online.m
index ee6f0402..26662574 100644
--- a/plotlysetup_online.m
+++ b/plotlysetup_online.m
@@ -1,228 +1,222 @@
function plotlysetup_online(username, api_key, varargin)
-% CALL: plotlysetup_online('username','api_key','kwargs'[optional]);
-% WHERE: kwargs are of the form ..,'property,value,'property',value,...
-% VALID PROPERTIES [OPTIONAL]: 'stream_ids' -> your stream ids [cell array] (found online)
-% 'plotly_domain' -> your desired REST API enpoint [string]
-% 'plotly_streaming_domain'-> your desired Stream API endpoint [string]
-% [1] adds plotly api to matlabroot/toolboxes. If successful do [2]
-% [2] adds plotly api to searchpath via startup.m of matlabroot and/or userpath
-% [3] calls saveplotlycredentials (using username, api_key and stream_ids [optional])
-% [4] calls saveplotlyconfig with ('plotly_domain'[optional], 'plotly_streaming_domain' [optional])
-
-%DEFAULT OUTPUT
-exception.message = '';
-exception.identifier = '';
-
-try %check number of inputs
- if (nargin<2||nargin>8)
- error('plotly:wrongInput',....
- ['\n\nWhoops! Wrong number of inputs. Please run >> help plotlysetup_online \n',...
- 'for more information regarding the setup your Plotly API MATLAB \n',...
- 'Library. Please post a topic on https://community.plotly.com/c/api/matlab/ for more information.']);
+ % CALL: plotlysetup_online('username','api_key','kwargs'[optional]);
+ % WHERE: kwargs are of the form ..,'property,value,'property',value,...
+ % VALID PROPERTIES [OPTIONAL]: 'stream_ids' -> your stream ids [cell array] (found online)
+ % 'plotly_domain' -> your desired REST API enpoint [string]
+ % 'plotly_streaming_domain'-> your desired Stream API endpoint [string]
+ % [1] adds plotly api to matlabroot/toolboxes. If successful do [2]
+ % [2] adds plotly api to searchpath via startup.m of matlabroot and/or userpath
+ % [3] calls saveplotlycredentials (using username, api_key and stream_ids [optional])
+ % [4] calls saveplotlyconfig with ('plotly_domain'[optional], 'plotly_streaming_domain' [optional])
+
+ %DEFAULT OUTPUT
+ exception.message = '';
+ exception.identifier = '';
+
+ try %check number of inputs
+ if (nargin<2||nargin>8)
+ error('plotly:wrongInput',....
+ ['\n\nWhoops! Wrong number of inputs. Please run >> help plotlysetup_online \n',...
+ 'for more information regarding the setup your Plotly API MATLAB \n',...
+ 'Library. Please post a topic on https://community.plotly.com/c/api/matlab/ for more information.']);
+ end
+ catch exception %plotlysetup input problem catch...
+ fprintf(['\n\n' exception.identifier exception.message '\n\n']);
+ return
end
-catch exception %plotlysetup input problem catch...
- fprintf(['\n\n' exception.identifier exception.message '\n\n']);
- return
-end
-try
- %check to see if plotly is in the searchpath
- plotlysetupPath = which('plotlysetup');
- plotlyFolderPath = fullfile(fileparts(plotlysetupPath),'plotly');
- %if it was not found
- if (strcmp(genpath(plotlyFolderPath),''))
- error('plotly:notFound',...
- ['\n\nShoot! It looks like MATLAB is having trouble finding the current version ' ...
- '\nof Plotly. Please make sure that the Plotly API folder is in the same ' ...
- '\ndirectory as plotlysetup.m. Questions? Ask on https://community.plotly.com/c/api/matlab/\n\n']);
+ try
+ %check to see if plotly is in the searchpath
+ plotlysetupPath = which('plotlysetup');
+ plotlyFolderPath = fullfile(fileparts(plotlysetupPath),'plotly');
+ %if it was not found
+ if (strcmp(genpath(plotlyFolderPath),''))
+ error('plotly:notFound',...
+ ['\n\nShoot! It looks like MATLAB is having trouble finding the current version ' ...
+ '\nof Plotly. Please make sure that the Plotly API folder is in the same ' ...
+ '\ndirectory as plotlysetup.m. Questions? Ask on https://community.plotly.com/c/api/matlab/\n\n']);
+ end
+ %add Plotly API MATLAB Library to search path
+ addpath(genpath(plotlyFolderPath));
+ catch exception %plotly file not found problem catch
+ fprintf(['\n\n' exception.identifier exception.message '\n']);
+ return
end
- %add Plotly API MATLAB Library to search path
- addpath(genpath(plotlyFolderPath));
-catch exception %plotly file not found problem catch
- fprintf(['\n\n' exception.identifier exception.message '\n']);
- return
-end
-if(~is_octave)
-
- try
- %embed the api to the matlabroot/toolbox dir.
- fprintf('\nAdding Plotly to MATLAB toolbox directory ... ');
-
- %plotly folder in the matlab/toolbox dir.
- plotlyToolboxPath = fullfile(matlabroot,'toolbox','plotly');
-
- if(exist(plotlyToolboxPath,'dir')) %check for overwrite...
- fprintf(['\n\n[UPDATE]: \n\nHey! We see that a copy of Plotly has previously been added to\n' ...
- 'your Matlab toolboxes. Would you like us to overwrite it with:\n' plotlyFolderPath ' ? \n'...
- 'Careful! You may lose data saved to this Plotly directory.\n\n']);
+ if ~is_octave
+ try
+ %embed the api to the matlabroot/toolbox dir.
+ fprintf('\nAdding Plotly to MATLAB toolbox directory ... ');
- overwrite = input('Overwrite (y/n) ? : ','s');
+ %plotly folder in the matlab/toolbox dir.
+ plotlyToolboxPath = fullfile(matlabroot,'toolbox','plotly');
- if(strcmpi(overwrite,'y'));
- fprintf('\n[OVERWRITE]:\n\nOverwriting Plotly! ... Done \n');
- else
- fprintf('\n[NO OVERWRITE]:\n\nDid not overwrite Plotly! ... Done \n');
+ if (exist(plotlyToolboxPath,'dir')) %check for overwrite...
+ fprintf(['\n\n[UPDATE]: \n\nHey! We see that a copy of Plotly has previously been added to\n' ...
+ 'your Matlab toolboxes. Would you like us to overwrite it with:\n' plotlyFolderPath ' ? \n'...
+ 'Careful! You may lose data saved to this Plotly directory.\n\n']);
+
+ overwrite = input('Overwrite (y/n) ? : ','s');
+
+ if (strcmpi(overwrite,'y'));
+ fprintf('\n[OVERWRITE]:\n\nOverwriting Plotly! ... Done \n');
+ else
+ fprintf('\n[NO OVERWRITE]:\n\nDid not overwrite Plotly! ... Done \n');
+ end
+ else %toolbox Plotly not yet created
+
+ %worked (without interuption)...just a formatting thing!
+ fprintf('Done\n');
+
+ %make the plotlyToolboxPath dir.
+ status = mkdir(plotlyToolboxPath);
+
+ %set status to overwrite
+ overwrite = 'y';
+
+ %check that the folder was created
+ if (status == 0)
+ error('plotly:savePlotly', permissionMessage('save the Plotly folder'));
+ end
end
- else %toolbox Plotly not yet created
-
- %worked (without interuption)...just a formatting thing!
- fprintf('Done\n');
- %make the plotlyToolboxPath dir.
- status = mkdir(plotlyToolboxPath);
+ if strcmpi(overwrite,'y')
+ %move a copy of the Plotly api to matlab root directory
+ [status, msg, messid] = copyfile(plotlyFolderPath,plotlyToolboxPath);
+ %check that the plotly api was copied to the matlab root toolbox directory
+ if (status == 0)
+ if (~strcmp(messid, 'MATLAB:COPYFILE:SourceAndDestinationSame'))
+ error('plotly:copyPlotly',permissionMessage('copy the Plotly folder'));
+ end
+ end
+ end
- %set status to overwrite
- overwrite = 'y';
+ %add it to the searchpath (startup.m will handle this next time!)
+ addpath(genpath(plotlyToolboxPath),'-end');
- %check that the folder was created
- if (status == 0)
- error('plotly:savePlotly', permissionMessage('save the Plotly folder'));
- end
- end
-
- if(strcmpi(overwrite,'y'))
+ %save plotly api searchpath to startup.m files (only do this if we actually were able to store the api in mtlroot/toolbox!)
+ fprintf('Saving Plotly to MATLAB search path via startup.m ... ');
- %move a copy of the Plotly api to matlab root directory
- [status, msg, messid] = copyfile(plotlyFolderPath,plotlyToolboxPath);
- %check that the plotly api was copied to the matlab root toolbox directory
- if (status == 0)
- if(~strcmp(messid, 'MATLAB:COPYFILE:SourceAndDestinationSame'))
- error('plotly:copyPlotly',permissionMessage('copy the Plotly folder'));
+ %check for a startup.m file in matlab rootpath (we want to add one here)
+ startupFile = [];
+ startupFileRootPath = fullfile(matlabroot,'toolbox','local','startup.m');
+ if (~exist(startupFileRootPath,'file'))
+ startFileID = fopen(startupFileRootPath, 'w');
+ %startup.m does not exist and startupFilePath is non-writable
+ if (startFileID == -1)
+ error('plotly:rootStartupCreation',permissionMessage('write the startup.m script'));
end
+ startupFile = {startupFileRootPath}; %needed because MATLAB only looks for startup.m when first opened.
end
- end
-
- %add it to the searchpath (startup.m will handle this next time!)
- addpath(genpath(plotlyToolboxPath),'-end');
-
- %save plotly api searchpath to startup.m files (only do this if we actually were able to store the api in mtlroot/toolbox!)
- fprintf('Saving Plotly to MATLAB search path via startup.m ... ');
-
- %check for a startup.m file in matlab rootpath (we want to add one here)
- startupFile = [];
- startupFileRootPath = fullfile(matlabroot,'toolbox','local','startup.m');
- if(~exist(startupFileRootPath,'file'))
- startFileID = fopen(startupFileRootPath, 'w');
- %startup.m does not exist and startupFilePath is non-writable
- if(startFileID == -1)
- error('plotly:rootStartupCreation',permissionMessage('write the startup.m script'));
+ %check for all startup.m file in searchpath
+ startupFile = [startupFile; cell(which('startup.m','-all'))];
+ %write the addpath - plotly api to the startup.m files
+ [warnings] = addplotlystartup(startupFile);
+
+ %worked!
+ fprintf(' Done\n');
+
+ %print any addplotlydstatup warnings;
+ w = cellfun(@isempty,warnings);
+ if find(~w)
+ %output warnings
+ exception.warnings = warnings;
+ fprintf(warnings{find(~w)});
end
- startupFile = {startupFileRootPath}; %needed because MATLAB only looks for startup.m when first opened.
- end
-
- %check for all startup.m file in searchpath
- startupFile = [startupFile; cell(which('startup.m','-all'))];
- %write the addpath - plotly api to the startup.m files
- [warnings] = addplotlystartup(startupFile);
-
- %worked!
- fprintf(' Done\n');
-
- %print any addplotlydstatup warnings;
- w = cellfun(@isempty,warnings);
- if(find(~w))
- %output warnings
- exception.warnings = warnings;
- fprintf(warnings{find(~w)});
+
+ catch exception %copying to toolbox/writing to startup.m permission problem catch...
+ fprintf(['\n\n' exception.identifier exception.message '\n\n']);
end
-
- catch exception %copying to toolbox/writing to startup.m permission problem catch...
- fprintf(['\n\n' exception.identifier exception.message '\n\n']);
- end
-
-else %if octave
- fprintf('\n\nOctave users: Automatic Plotly API embedding coming soon!\n\n');
-end %end check for matlab...
+ else %if octave
+ fprintf('\n\nOctave users: Automatic Plotly API embedding coming soon!\n\n');
+ end %end check for matlab...
-try %save user credentials
- fprintf('Saving username/api_key credentials ... ');
+ try %save user credentials
+ fprintf('Saving username/api_key credentials ... ');
- %update: as of v.2.1.7, This also signs in the user
- saveplotlycredentials(username, api_key);
+ %update: as of v.2.1.7, This also signs in the user
+ saveplotlycredentials(username, api_key);
- %worked!
- fprintf('Done\n');
-catch exception %writing credentials file permission problem catch...
- fprintf(['\n\n' exception.identifier exception.message '\n\n']);
-end
-
-%----handle varargin----%
-try
- %check for ..,property,value,.. structure
- if mod(numel(varargin),2)~= 0
- error('plotly:wrongInputVarargin',....
- ['\n\nWhoops! Wrong number of varargin inputs. Please run >> help plotlysetup \n',...
- 'for more information regarding the setup of your Plotly API MATLAB Library. \n',...
- 'Your stream_ids, plotly_domain, and plotly_streaming domain were not set. \n',...
- 'Questions? Please post on https://community.plotly.com/c/api/matlab/22.']);
+ %worked!
+ fprintf('Done\n');
+ catch exception %writing credentials file permission problem catch...
+ fprintf(['\n\n' exception.identifier exception.message '\n\n']);
end
-
- for n = 1:2:numel(varargin)
- %check for correct property names
- if isempty(intersect(varargin{n},{'stream_ids','plotly_domain','plotly_streaming_domain'}))
- error('plotly:wrongInputPropertyName',....
- ['\n\nWhoops! The properperty name: ' varargin{n} ' is invalid. \n',...
- 'Please run >> help plotlysetup for more information regarding\n',...
- 'the setup your Plotly API MATLAB Library.']);
+
+ %----handle varargin----%
+ try
+ %check for ..,property,value,.. structure
+ if mod(numel(varargin),2)~= 0
+ error('plotly:wrongInputVarargin',....
+ ['\n\nWhoops! Wrong number of varargin inputs. Please run >> help plotlysetup \n',...
+ 'for more information regarding the setup of your Plotly API MATLAB Library. \n',...
+ 'Your stream_ids, plotly_domain, and plotly_streaming domain were not set. \n',...
+ 'Questions? Please post on https://community.plotly.com/c/api/matlab/22.']);
end
- if strcmp(varargin{n},'stream_ids')
- fprintf('Saving stream_ids credentials ... ');
+ for n = 1:2:numel(varargin)
+ %check for correct property names
+ if isempty(intersect(varargin{n},{'stream_ids','plotly_domain','plotly_streaming_domain'}))
+ error('plotly:wrongInputPropertyName',....
+ ['\n\nWhoops! The properperty name: ' varargin{n} ' is invalid. \n',...
+ 'Please run >> help plotlysetup for more information regarding\n',...
+ 'the setup your Plotly API MATLAB Library.']);
+ end
+ if strcmp(varargin{n},'stream_ids')
+ fprintf('Saving stream_ids credentials ... ');
- %update: as of v.2.1.7, This also signs in the user
- saveplotlycredentials(username, api_key, varargin{n+1});
+ %update: as of v.2.1.7, This also signs in the user
+ saveplotlycredentials(username, api_key, varargin{n+1});
- %worked!
- fprintf('Done\n');
- end
- if strcmp(varargin{n},'plotly_domain')
- fprintf('Saving plotly_domain configuration ... ');
+ %worked!
+ fprintf('Done\n');
+ end
+ if strcmp(varargin{n},'plotly_domain')
+ fprintf('Saving plotly_domain configuration ... ');
- %update: as of v.2.1.7, This also signs in the user
- saveplotlyconfig(varargin{n+1});
+ %update: as of v.2.1.7, This also signs in the user
+ saveplotlyconfig(varargin{n+1});
- %worked!
- fprintf('Done\n');
- end
- if strcmp(varargin{n},'plotly_streaming_domain')
- fprintf('Saving plotly_streaming_domain configuration ... ');
- try
- config = loadplotlyconfig;
- catch
- config.plotly_domain = '';
+ %worked!
+ fprintf('Done\n');
end
+ if strcmp(varargin{n},'plotly_streaming_domain')
+ fprintf('Saving plotly_streaming_domain configuration ... ');
+ try
+ config = loadplotlyconfig;
+ catch
+ config.plotly_domain = '';
+ end
- %update: as of v.2.1.7, This also signs in the user
- saveplotlyconfig(config.plotly_domain,varargin{n+1});
+ %update: as of v.2.1.7, This also signs in the user
+ saveplotlyconfig(config.plotly_domain,varargin{n+1});
- %worked!
- fprintf('Done\n');
+ %worked!
+ fprintf('Done\n');
+ end
end
+
+ catch exception %writing varargin problem catch...
+ fprintf(['\n\n' exception.identifier exception.message '\n\n']);
end
-
-catch exception %writing varargin problem catch...
- fprintf(['\n\n' exception.identifier exception.message '\n\n']);
-end
-
-%greet the people!
-fprintf('\nWelcome to Plotly! If you are new to Plotly please enter: >> plotlyhelp to get started!\n\n')
+ %greet the people!
+ fprintf('\nWelcome to Plotly! If you are new to Plotly please enter: >> plotlyhelp to get started!\n\n')
end
%helper message function
function message = permissionMessage(spec)
-message = ['\n\nShoot! We tried to ' spec ' to the MATLAB toolbox \n',...
- 'directory, but were denied write permission. You''ll have to add\n',...
- 'the Plotly folder to your MATLAB path manually by running: \n\n',...
- '>> plotly_path = fullfile(pwd, ''plotly'')\n',...
- '>> addpath(genpath(plotly_path))\n\n',...
- 'You can save your credentials by running:\n\n', ...
- '>>saveplotlycredentials(''your_username'', ''your_api_key'')\n\n',...
- 'You can save your domain configuration by running:\n\n',...
- '>>saveplotlyconfig(''your_base_domain'')\n\n',...
- 'Questions? Ask https://community.plotly.com/c/api/matlab/\n\n'];
+ message = ['\n\nShoot! We tried to ' spec ' to the MATLAB toolbox \n',...
+ 'directory, but were denied write permission. You''ll have to add\n',...
+ 'the Plotly folder to your MATLAB path manually by running: \n\n',...
+ '>> plotly_path = fullfile(pwd, ''plotly'')\n',...
+ '>> addpath(genpath(plotly_path))\n\n',...
+ 'You can save your credentials by running:\n\n', ...
+ '>>saveplotlycredentials(''your_username'', ''your_api_key'')\n\n',...
+ 'You can save your domain configuration by running:\n\n',...
+ '>>saveplotlyconfig(''your_base_domain'')\n\n',...
+ 'Questions? Ask https://community.plotly.com/c/api/matlab/\n\n'];
end