-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Right click on a graph can now be used for manual QC. It differs from…
… the left click in that instead of highlighting what is included in the box, it highlights what is outside the box.
- Loading branch information
Showing
4 changed files
with
73 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,8 @@ | |
% data. If no data points lie within the highlight region, | ||
% an empty matrix is returned. | ||
% | ||
% Author: Paul McCarthy <[email protected]> | ||
% Author: Paul McCarthy <[email protected]> | ||
% Contributor: Guillaume Galibert <[email protected]> | ||
% | ||
|
||
% | ||
|
@@ -39,4 +40,48 @@ | |
% along with this program. | ||
% If not, see <https://www.gnu.org/licenses/gpl-3.0.en.html>. | ||
% | ||
highlight = highlightTimeSeriesGeneric(region, data, variable, type); | ||
narginchk(4, 4); | ||
|
||
if ~isnumeric(region) || ~isvector(region) || length(region) ~= 4 | ||
error('region must be a numeric vector of length 4'); | ||
end | ||
|
||
if ~ishandle(data), error('data must be a graphics handle'); end | ||
if ~isstruct(variable), error('variable must be a struct'); end | ||
if ~ischar(type), error('type must be a string'); end | ||
|
||
xdata = get(data(1), 'XData'); % data(1) retrieves the current graphic handles only, in case extra sample is selected | ||
ydata = get(data(1), 'YData'); | ||
|
||
if iscell(xdata) | ||
xdata = cell2mat(xdata)'; | ||
ydata = cell2mat(ydata)'; | ||
end | ||
|
||
if strcmp(type, 'alt') % right click | ||
% figure out indices of all data points outside the X range but within | ||
% the Y range | ||
xidx = (xdata < region(1)) | (xdata > region(3)); | ||
yidx = (ydata >= region(2)) & (ydata <= region(4)); | ||
else | ||
% figure out indices of all data points within the X and Y range | ||
xidx = (xdata >= region(1)) & (xdata <= region(3)); | ||
yidx = (ydata >= region(2)) & (ydata <= region(4)); | ||
end | ||
|
||
% figure out indices of all the points to be highlighted | ||
idx = xidx & yidx; | ||
|
||
if ~any(idx) | ||
% return nothing if no points to plot | ||
highlight = []; | ||
else | ||
% create the highlight | ||
highlight = line(xdata(idx),ydata(idx), ... | ||
'UserData', idx, ... | ||
'Parent', gca, ... | ||
'LineStyle', 'none', ... | ||
'Marker', 'o', ... | ||
'MarkerEdgeColor', 'white', ... | ||
'MarkerFaceColor', 'white'); | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters