V_YTICKINT removes non-integer ticks from a plot YTICK=(AX) Usage: plot(...); % plot a graph v_ytickint; % remove any non-integer tick marks Inputs: ax axis to remove ticks from [current plot axis] Outputs: ytick list of remaining tick positions
0001 function ytick=v_ytickint(ax) 0002 %V_YTICKINT removes non-integer ticks from a plot YTICK=(AX) 0003 % 0004 % Usage: plot(...); % plot a graph 0005 % v_ytickint; % remove any non-integer tick marks 0006 % 0007 % Inputs: ax axis to remove ticks from [current plot axis] 0008 % 0009 % Outputs: ytick list of remaining tick positions 0010 0011 % Copyright (C) Mike Brookes 2024 0012 % Version: $Id: v_xtickint.m $ 0013 % 0014 % VOICEBOX is a MATLAB toolbox for speech processing. 0015 % Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html 0016 % 0017 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0018 % This program is free software; you can redistribute it and/or modify 0019 % it under the terms of the GNU General Public License as published by 0020 % the Free Software Foundation; either version 2 of the License, or 0021 % (at your option) any later version. 0022 % 0023 % This program is distributed in the hope that it will be useful, 0024 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0025 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0026 % GNU General Public License for more details. 0027 % 0028 % You can obtain a copy of the GNU General Public License from 0029 % http://www.gnu.org/copyleft/gpl.html or by writing to 0030 % Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA. 0031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0032 if nargin<1 || isempty(ax) 0033 ax=gca; % use current axes 0034 end 0035 ytick=get(ax,'ytick'); 0036 set(ax,'ytick',ytick(round(ytick)==ytick));