File Exchange

image thumbnail

tick2text: create easy-to-customize tick labels

version 1.7 (62.5 KB) by

Customized tick marks, maintained on zoom and pan



Allows automatically-updating customized tick marks in Matlab

Comments and Ratings (9)

Liad Mudrik

I've been trying to use this function to replace the ticks with letter strings (e.g., 'frontal', 'temporal', etc.) that are stored in cell array. I get an error message saying that the function does not accept cell as input. How can I solve the problem?


Great program. Thank you. I particularly like the option to use sprintf formatting.

I would appreciate being able to adjust the offset in orthogonal planes. By this I mean being able to apply an x-offset to the y-labels or a z-offset to the x-labels.

Kelly Kearney

Kelly Kearney (view profile)

C Berry,

I'm not quite sure what you mean when you say it doesn't parse a minus sign; can you give a small example?

C Berry

I'd like to use this to label the axes using the LaTeX interpreter, however it appears to be impossible to successfully parse a minus sign, which is rather annoying. Does anyone have any ideas?

Frank Hart

I like this function's potential, but I'm not presently able to use it well. I'm working with x-axis limits that are multiples of pi, and I'd like to label the axis as such. It is unclear how to do this. Your example simply appends a pi. I'd like to specify the XTicks at pi-based intervals (possibly fractional), then use tick2text to place labels with pi in the tick marks.

For example, consider a uniform probability density function for a radian angle. It is distributed (x-axis) between [-pi,pi] and has a value of 1/(2*pi). I'd like to tick the x-axis at, say, pi/4 intervals, and the y-axis at 1/pi, 1/[2*pi], 1/[4*pi], etc. etc.

Andrew .

When using this function, the tick labels overlap axis labels, so this function is only useful if xlabel or ylabel is not required

Mukhtar Ullah

Sorry, forgot to rate it.

Mukhtar Ullah

Very clever!
If the tick-label position is computed relative to xlabel, ylabel and zlabel, this function can be extended to 3-D figures as well.



Linked to GitHub repository


- updated for 2014b graphics


Credited parse_pv_pairs as a separate FEX entry


- no longer need to manually specify axis offsets
- added simple reformat without conversion-to-text option
- more robust handing of non-default configured axes ([XYZ]Dir, [XYZ]Scale, and [XY]AxisLocation properties changed)


Added ability to modify x,y, and z ticks for 3D axes


Fixed erroneous behavior when axes are logarithmically scaled


Added function handle input option, corrected some bugs, and added new example

MATLAB Release
MATLAB 7.4 (R2007a)

Inspired by: Format Tick Labels

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

» Watch video