Code covered by the BSD License

### Highlights from Format Tick Labels (Extended)

4.25
4.2 | 4 ratings Rate this file 20 Downloads (last 30 days) File Size: 18.4 KB File ID: #23841 Version: 1.1

# Format Tick Labels (Extended)

### Patrick Toche (view profile)

20 Apr 2009 (Updated )

Replace Tick Label with LaTeX compatible Objects. Extends file 15986 created by Alexander Hayes.

File Information
Description

Will replace axes tick labels with formatted text objects that can include both Tex and LaTex interpreted strings. Primary example is to add degree symbols to labels. Inputs can be a cell array of strings or a single string to be appended to the end of each of the current labels. Header documentation includes several examples. Labels can also be rotated.
08/19/2007: Created by Alex Hayes
04/20/2009: Minor Update by Patrick Toche
Introduces a distinction between offsets for the horizontal axis offsetx and for the vertical axis offsety. It took 2 minutes to modify the original file, so credit must go to Alexander Hayes. Any errors are mine, of course.

Acknowledgements

Format Tick Labels inspired this file.

This file inspired Format Tick Labels (Extended V2).

MATLAB release MATLAB 7.7 (R2008b)
MATLAB Search Path
/
27 Aug 2013 David Doria

### David Doria (view profile)

The x axis label seems to overlap the x tick labels?

data=rand(5);

plot(0:pi/4:pi, data,'LineWidth', 3);

format_ticks(gca,{'0', '\pi/4', '\pi/2', '3\pi/4', '\pi'},[],0:pi/4:pi)

ylim([0 1]);
xlabel('My x label')
ylabel('My y label')

fontSize = 20;

set(gca,'FontSize',fontSize)

Comment only
30 Jul 2013 Gisela Galmiche

### Gisela Galmiche (view profile)

05 Jul 2012 Oliver Woodford

### Oliver Woodford (view profile)

Handy, but could use the same font as the axes by default. Currently you have to set this manually.

25 Oct 2011 Robert Sparr

### Robert Sparr (view profile)

Very nice. I've wanted a way to do this for a long time.

Two improvements would be nice: (1) Add support for doing only Y ticks. (2) Check for an axis label and reposition it correctly so that it does not overlap with the new tick labels.

05 Jun 2011 Igor

### Igor (view profile)

Exactly what i was looking for...

However, 2 tiny suggestions:

To be able to use Y-ticks only one should replace 2 strings around #225 with
======================================
%find out if we have to use the LaTex interpreter
all_ticks = [tickx ticky];
temp = all_ticks{1};
======================================

it's also a bit unexpected that
offsety>0 means 'left' ...