-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathincludeZero.m
More file actions
33 lines (27 loc) · 924 Bytes
/
includeZero.m
File metadata and controls
33 lines (27 loc) · 924 Bytes
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
function h = includeZero(varargin)
%INCLUDEZERO Include the [0 0] coordinates in a plot
% includeZero() makes sure the plot will always show [0 0] by plotting an
% invisible point.
%
% h = includeZero() returns the handle to the invisible point.
%
% includeZero(x, y) overrules the coordinates for the invisible point.
% Check current status of ishold and set hold to on
currIshold = ishold();
hold('on');
% Handle input/output
p = inputParser();
p.addOptional('x', 0);
p.addOptional('y', 0);
p.parse(varargin{:});
p = p.Results;
% Plot the point and make it invisible
h = plot(p.x, p.y, '.w');
set(h, 'LineStyle', 'none', 'Marker', 'none');
% Prevent a legend entry
set(get(get(h, 'Annotation'), 'LegendInformation'), 'IconDisplayStyle', 'off');
% Set hold to off if it originally was
if ~currIshold
hold('off');
end
end