-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathcmtplot.m
More file actions
98 lines (84 loc) · 2.24 KB
/
Copy pathcmtplot.m
File metadata and controls
98 lines (84 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
classdef cmtplot < cmtobject
% CMTPLOT collects common CMT plot tasks.
%
% This is probably more convoluted than it needs to be.
% This file is a part of the CMToolbox.
% It is licensed under the BSD 3-clause license.
% (See LICENSE.)
% Copyright Toby Driscoll, 2014.
% Written by Everett Kropf, 2014.
properties(Constant)
% colors
black = 'k'
grey = 0.75*[1, 1, 1]
none = 'none'
end
methods
function p = cmtplot
% This is here to allow get/set functionality.
get(p, plotset);
end
end
methods(Static)
function [args, exargs] = closedcurveArgs(varargin)
opts = get(cmtplot);
if nargout > 1
[opts, exargs] = set(opts, varargin{:});
else
opts = set(opts, varargin{:});
end
args = { ...
'color', opts.lineColor, ...
'linewidth', opts.lineWidth ...
};
if ~cmtplot.hasNewGraphics
args(5:6) = {'linesmoothing', opts.lineSmoothing};
end
end
function args = fillargs()
args = {cmtplot.fillcolor, 'edgecolor', cmtplot.filledgecolor};
end
function c = fillcolor()
c = cmtplot.grey;
end
function c = filledgecolor()
c = cmtplot.none;
end
function [args, exargs] = gridArgs(varargin)
opts = get(cmtplot);
if nargout < 2
opts = set(opts, varargin{:});
else
[opts, exargs] = set(opts, varargin{:});
end
args = {
'color', opts.gridColor, ...
'linewidth', opts.lineWidth ...
};
if ~cmtplot.hasNewGraphics
args(5:6) = {'linesmoothing', opts.lineSmoothing};
end
end
function tf = hasNewGraphics()
tf = ~verLessThan('matlab', '8.4');
end
function tf = isFigHandle(val)
if exist('isgraphics', 'builtin') == 5
tf = isgraphics(val, 'figure');
else
% Revert to older way.
if ishghandle(tmp)
tf = strcmp(get(tmp, 'type'), 'figure');
else
tf = false;
end
end
end
function whitefigure(fig)
if ~nargin
fig = gcf;
end
set(fig, 'color', 'white');
end
end
end