Skip to content
This repository was archived by the owner on Apr 5, 2019. It is now read-only.

Commit e693822

Browse files
committed
Convert to Abstract class, minor syntax cleanup
1 parent 0883b24 commit e693822

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

legtools.m

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,18 @@
1-
classdef legtools
1+
classdef (Abstract) legtools
22
% LEGTOOLS is a MATLAB class definition providing the user with a set of
33
% methods to modify existing Legend objects.
44
%
55
% This is an HG2 specific implementation and requires MATLAB R2014b or
66
% newer.
77
%
88
% legtools methods:
9-
% append - Add one or more entries to the end of the legend
10-
% permute - Rearrange the legend entries
11-
% remove - Remove one or more legend entries
12-
% adddummy - Add one or more entries to the legend for unsupported graphics objects
9+
% append - Add one or more entries to the end of the legend
10+
% permute - Rearrange the legend entries
11+
% remove - Remove one or more legend entries
12+
% adddummy - Add one or more entries to the legend for unsupported graphics objects
1313
%
1414
% See also legend
1515

16-
methods
17-
function obj = legtools
18-
% Dummy constructor so we don't return an empty class instance
19-
clear obj
20-
end
21-
end
22-
2316
methods (Static)
2417
function append(lh, newStrings)
2518
% APPEND appends strings, newStrings, to the specified Legend
@@ -143,8 +136,6 @@ function remove(lh, remidx)
143136
);
144137
end
145138

146-
147-
148139
if numel(unique(remidx)) == numel(lh.String)
149140
delete(lh);
150141
warning('legtools:remove:LegendDeleted', ...
@@ -219,8 +210,6 @@ function adddummy(lh, newStrings, plotParams)
219210
end
220211
end
221212

222-
% TODO: More plotParams error checking
223-
224213
parentaxes = lh.PlotChildren(1).Parent;
225214

226215
washeld = ishold(parentaxes); % Set a flag for previous hold state ofthe parent axes
@@ -242,7 +231,7 @@ function adddummy(lh, newStrings, plotParams)
242231
methods (Static, Access = private)
243232
function verchk()
244233
% Throw error if we're not using R2014b or newer
245-
if verLessThan('matlab','8.4')
234+
if verLessThan('matlab', '8.4')
246235
error('legtools:UnsupportedMATLABver', ...
247236
'MATLAB releases prior to R2014b are not supported' ...
248237
);
@@ -293,13 +282,13 @@ function verchk()
293282
% out our error
294283
error(msgID, ...
295284
'Invalid Data Type Passed: %s\n\nData must be of type: ''%s'', ''%s'', or ''%s''', ...
296-
class(newString), class(cell(1)), class(char('')), class(string('')) ...
285+
class(newString), class(cell(1)), class(''), class("") ...
297286
);
298287
else
299288
% Error message for MATLAB versions older than R2016b
300289
error(msgID, ...
301290
'Invalid Data Type Passed: %s\n\nData must be of type: ''%s'' or ''%s''', ...
302-
class(newString), class(cell(1)), class(char('')) ...
291+
class(newString), class(cell(1)), class('') ...
303292
);
304293
end
305294
end

0 commit comments

Comments
 (0)