MATLAB: Is it possible to remove only specific tick mark(s) while keeping tick labels

axesfigureMATLABticktick labelstick marksticks

I want to remove some number of specific tick marks, keeping all others, and keeping all the tick labels.
Is this possible?
As a side note, I know that one can set the TickLength property to [0 0], but that affects all the tick marks.

Best Answer

No; removing a tick clears the associated label; there's an inbuilt 1:1 correlation; "no tickee, no lablee".
To do this would require either
  1. drawing the ticks specifically; as you note there isn't sufficient granularity in HG2 to specify individual tick lengths or colors to simulate the effect, or
  2. deleting the desired ticks then text in the labels for those locations
Oh, alternatively, you could probably overlay two axes to achieve the combined effect between the two...
hAx=axes; % new axes
xt=hAx.XTick; % retrieve ticks
hAx.XTick=xt(1:2:end); % clear some
hAx(2)=axes('position',hAx.Position'); % second axes on top of first
hAx(1).XTickLabel=[]; % turn labels of first off
hAx(2).TickLength=[0,0]; % set ticks to zero length 2nd
hAx(2).YTick=[]; % get rid duplicates for y
axes(hAx(1)) % bring first to foreground
results in
Overall, one of the first two options is probably simpler in the end...