Tick ​​color change only in Matlab shapes

I have a shape, and I would like to show the positions of the ticks (in white), but keep the tag 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');

enter image description here

You can see that the tick positions are not visible. Matlab's documentation suggests that you can use a descriptor YColorand XColor, but they also control the color of label labels. For example: enter image description here

I tried to get a checkmark, but it doesn’t look very good. I tried to play with an approach similar to that discussed here , but to no avail. The last way I can think of is to manually rewrite labels as text objects ... Your entry will be appreciated.

+4
1

, spring.

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', [])

-

Clone axes and modify attributes

+6

Source: https://habr.com/ru/post/1534727/


All Articles