I have a figure and I'd like to be able to show the ticks positions (in white) but keep the tick labels (in black). For example, if you try:
imagesc(abs(peaks(10))); colormap('bone');
set(gca,'XTick',0:pi:2*pi,'XTickLabel',{'0', 'p', '2p'},'fontname','symbol');
You can see that the tick positions can't be seen. Matlab's documentation tells that the handle YColor
and XColor
can be used, but they also control the color of the tick labels. For example:
I have tried to get the tick out, but it doesn't look good. I tried playing with an approach similar to the one discussed here, but without success. The last way I can think of is to "manually" rewrite the labels as text objects... Would appreciate your input.
Since there are no independent attributes for the ticks, only tailor-made tricks spring to mind.
The result of this
imagesc(abs(peaks(10)));
colormap('bone');
set(gca, 'XTick', 0:pi:2*pi, 'XTickLabel', {'0', 'p', '2p'}, 'fontname','symbol');
a = gca;
b = copyobj(a, gcf)
set(b, 'Xcolor', [1 1 1], 'YColor', [1 1 1], 'XTickLabel', [], 'YTickLabel', [])
is this
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With