开发者

MATLAB: Can axes tick labels be accesed as text objects?

开发者 https://www.devze.com 2022-12-27 22:21 出处:网络
I\'m curious is it possible to change text properties of tick labels 开发者_开发问答independently of axes properties. Do they have handles? I\'d like to control their position better, alignment, color

I'm curious is it possible to change text properties of tick labels 开发者_开发问答independently of axes properties. Do they have handles? I'd like to control their position better, alignment, color, fonts, etc. I know I can substitute them with text labels, but it has some drawbacks. Any alternative solutions?

Particularly, is it possible to put xticklabels between ticks, that are irregular?

plot(1:100)
set(gca,'xtick',[30 45 53 70 95])
grid on

I need to put xticklabels in the middle between grids.


To put xicklabels between ticks, I would plot a second set of axes on top of the first. LINKZOOM from the file exchange makes sure that you have no problems zooming.

plot(1:100),
ah=gca;
%# make arbitrary ticks
set(ah,'xtick',[30 45 53 70 95],'xticklabels',[])

%# create new axes with labels placed in the middle
ah2=axes('parent',gcf,'position',get(ah,'Position'),'color','none',...
'ticklength',[0,0],'xtick',([45 53 70 95]+[30 45 53 70])/2,'xlim',[0,100],'ylim',[0,100])

%# link all axes in the figure
linkzoom;
0

精彩评论

暂无评论...
验证码 换一张
取 消