|
19 | 19 | % 'xlim' : 'auto', [xmin, xmax] |
20 | 20 | % 'ylim' : 'auto', [ymin, ymax] |
21 | 21 | % 'legend' : 'on', 'off' |
22 | | -% 'export' : see MATLAB documentation on print functions |
| 22 | +% 'export' : see MATLAB documentation on print functions (ex. {'myfig', '-dtiff', '-r300'}) |
| 23 | +% 'color' : RGB array |
23 | 24 | % 'colormap' : 'parula', 'jet', 'hsv', 'hot', 'cool', 'spring', 'summer', |
24 | 25 | % 'autumn', 'winter', 'gray', 'bone', 'copper', 'pink' |
25 | 26 | % |
|
39 | 40 | % 'ylim' : y-axis limits (default = 'auto') |
40 | 41 | % 'legend' : display legend (default = 'on') |
41 | 42 | % 'export' : options passed to the MATLAB print function (default = 'off') |
| 43 | +% 'color' : manually set the RGB values used for line colors (default = 'off') |
42 | 44 | % 'colormap' : select colormap to use for plotting (default = 'parula') |
43 | 45 | % |
44 | 46 | % Examples |
|
86 | 88 |
|
87 | 89 | % Input values |
88 | 90 | y = data(samples(i)).tic.values; |
89 | | - |
| 91 | + |
| 92 | + % Check for sparse matrix |
| 93 | + if issparse(y) |
| 94 | + y = full(y); |
| 95 | + end |
| 96 | + |
90 | 97 | % Check baseline |
91 | 98 | if any(strcmpi(options.baseline, {'on', 'corrected'})) |
92 | 99 | baseline = data(samples(i)).tic.baseline; |
|
105 | 112 | if strcmpi(options.legend, 'on') |
106 | 113 | names = options.name(i); |
107 | 114 | else |
108 | | - names = ''; |
| 115 | + names = {''}; |
109 | 116 | end |
110 | 117 |
|
111 | 118 | case 'all' |
112 | 119 |
|
113 | 120 | % Input values |
114 | 121 | y = data(samples(i)).xic.values; |
115 | 122 |
|
| 123 | + % Check for sparse matrix |
| 124 | + if issparse(y) |
| 125 | + y = full(y); |
| 126 | + end |
| 127 | + |
116 | 128 | % Check baseline |
117 | 129 | if any(strcmpi(options.baseline, {'on', 'corrected'})) |
118 | 130 | baseline = data(samples(i)).xic.baseline; |
|
140 | 152 | % Input values |
141 | 153 | y = data(samples(i)).xic.values(:, options.ions); |
142 | 154 |
|
| 155 | + % Check for sparse matrix |
| 156 | + if issparse(y) |
| 157 | + y = full(y); |
| 158 | + end |
| 159 | + |
143 | 160 | % Check baseline |
144 | 161 | if any(strcmpi(options.baseline, {'on', 'corrected'})) |
145 | 162 | baseline = data(samples(i)).xic.baseline; |
|
195 | 212 | switch version('-release') |
196 | 213 |
|
197 | 214 | case '2014b' |
198 | | - line(x, y,... |
| 215 | + plot(x, y,... |
199 | 216 | 'parent', options.axes, ... |
200 | 217 | 'linewidth', options.linewidth, ... |
201 | 218 | 'displayname', [names{:}]); |
202 | 219 |
|
203 | 220 | otherwise |
204 | | - line(x, y,... |
| 221 | + plot(x, y,... |
205 | 222 | 'parent', options.axes,... |
206 | 223 | 'linewidth', options.linewidth,... |
207 | 224 | 'linesmoothing', 'on',... |
@@ -473,7 +490,11 @@ function plot_update(options) |
473 | 490 |
|
474 | 491 | % Check color options |
475 | 492 | if isempty(options.colormap) && ~isempty(options.color) |
476 | | - options.colormap = options.color; |
| 493 | + if iscell(options.color) |
| 494 | + options.colormap = options.color{1}; |
| 495 | + else |
| 496 | + options.colormap = options.color; |
| 497 | + end |
477 | 498 | end |
478 | 499 |
|
479 | 500 | % Determine color order |
@@ -533,8 +554,9 @@ function plot_update(options) |
533 | 554 | 'color', 'none',... |
534 | 555 | 'linewidth', options.line.width,... |
535 | 556 | 'tickdir', 'out',... |
536 | | - 'ticklength', options.ticks.size,... |
537 | | - 'nextplot', 'add'); |
| 557 | + 'ticklength', options.ticks.size); |
| 558 | + |
| 559 | +hold all |
538 | 560 |
|
539 | 561 | % Set x-axis label |
540 | 562 | options.xlabel = xlabel(... |
@@ -620,11 +642,11 @@ function plot_update(options) |
620 | 642 |
|
621 | 643 | % Check input |
622 | 644 | if nargin < 1 |
623 | | - error('Not enough input arguments'); |
| 645 | + error('Not enough input arguments.'); |
624 | 646 | elseif isstruct(varargin{1}) |
625 | 647 | data = DataStructure('validate', varargin{1}); |
626 | 648 | else |
627 | | - error('Undefined input arguments of type ''data'''); |
| 649 | + error('Undefined input arguments of type ''data''.'); |
628 | 650 | end |
629 | 651 |
|
630 | 652 | % Check user input |
@@ -1096,11 +1118,13 @@ function plot_update(options) |
1096 | 1118 | % Set default options |
1097 | 1119 | options.export = {'chromatography_export', '-dpng', '-r300'}; |
1098 | 1120 |
|
| 1121 | + elseif iscell(export) |
| 1122 | + options.export = export; |
| 1123 | + |
1099 | 1124 | elseif any(strcmpi(export, {'default', 'off'})) |
1100 | 1125 | options.export = []; |
1101 | | - |
1102 | | - % Check input type |
1103 | | - elseif ~iscell(export) |
| 1126 | + |
| 1127 | + else |
1104 | 1128 | options.export = []; |
1105 | 1129 | end |
1106 | 1130 |
|
|
0 commit comments