views:

231

answers:

1

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.

+1  A: 

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;
Jonas
Thanks, I didn't think about it. Not working yet tough. Cannot see new labels for some reason. I'll continue tomorrow.
yuk
Ah, forgot about xlim! Great! Special thanks for LINKZOOM.
yuk
@yuk: I had the same problems with not seeing the labens in the beginning. I guess I plotted about 10 times before I figured it out :)
Jonas
I have added xlim explicitly now
Jonas
So, I assume, the answer for the subject question is no, right?
yuk
As far as I know, the answer is no for the subject question.
Jonas