View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

4.8 | 14 ratings Rate this file 8 Downloads (last 30 days) File Size: 1.89 KB File ID: #19059 Version: 1.0




05 Mar 2008 (Updated )

Replaces XTickLabels with "normal" texts accepting multiline texts and TEX interpreting

| Watch this File

File Information

MY_XTICKLABELS replaces XTickLabels with "normal" texts accepting multiline texts and TEX interpreting and shrinks the axis to fit the texts in the window.

MATLAB release MATLAB 7.5 (R2007b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (18)
04 Jul 2016 BK

BK (view profile)

06 Jun 2016 Martin Schrimpf

28 Aug 2015 Artem Kabannik

Then subsequent code should look like:
ht(ii) = text('String',xtickstring{ii}, ...
'Units','data', ...
'VerticalAlignment', 'top', ...
'HorizontalAlignment', 'center ', ...
'Position',[xtickpos(ii) Ybot], ...
'Tag','MUXTL', 'Parent', Ha);

Comment only
28 Aug 2015 Artem Kabannik

It seems that I have found a bug at line 54:

In the code:
Ybot = min(get(gca,'YLim'));

I changed it to:
Ybot = min(get(Ha,'YLim'));

Comment only
13 Jan 2014 Liaofan Lin

07 Jun 2013 Mikhail Erofeev

04 Mar 2013 dzq

dzq (view profile)

Tanks! You're a good guy.

Comment only
03 Apr 2012 Mauro Donzelli

03 Apr 2012 Mauro Donzelli

02 Mar 2012 Kristofer Kusano

Very nice, thanks for posting this

02 Mar 2012 Kristofer Kusano

09 Dec 2011 craq

craq (view profile)

This is a very useful tool. One suggestion though: the text() command gets confused if there is more than one axis, so maybe you can set the current axis to Ha with axes(Ha) before the cell '%% Make XTickLabels'.

01 Sep 2011 Du Xiao

Perfect, Thank you very much for your help!

10 Sep 2010 Andrew Schwartz

Works for the most part. Manageable issue: labels remain in same figure positions when changing the axis using axis(xylims) rather than moving to the new correct locations relative to the axes. Solution for now is of course to only call my_xticklabels after axis limits have been set.

24 Nov 2009 Dominik Bach

After switching to (R2009a), the squeeze axes part of the function does not work any more. Converting the axes units to pixels produces negative values for some reason, hence the function crashes. Otherwise still very helpful.

Comment only
20 Jun 2009 Wilbert Zarco

It solves the 'xticklabels' limitation of lacking Tex capabilities, and I think also the work for the matlab team to implementing it. Great job!

18 Jul 2008 Claude Mueller

worked great for me! thanks!!

22 Apr 2008 Bob Farrell

Perfect. Just what I was looking for. It does what it says and was a drop-in into my code. I needed multi-line xtick labels, and the TEX characters were a bonus.

Contact us