Code covered by the BSD License  

Highlights from
tick2text: create easy-to-customize tick labels

4.2

4.2 | 5 ratings Rate this file 60 Downloads (last 30 days) File Size: 4.53 KB File ID: #16003
image thumbnail

tick2text: create easy-to-customize tick labels

by Kelly Kearney

 

20 Aug 2007 (Updated 30 Jun 2009)

Changes tick marks to text objects that can be easily customized, maintains customization in zooming

| Watch this File

File Information
Description

This function creates text objects that mimic x, y, and z tick labels, while the original tick labels are removed. The text object format allows more modification (such as color, rotation, etc) than the original tick labels, and also allows TeX strings to be utilized in tick labels. The modifications to the tick labels are maintained during zooming and panning as well.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
Format Tick Labels

MATLAB release MATLAB 7.4 (R2007a)
Other requirements Requires R2007a+ for zoom and pan
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (8)
23 Aug 2007 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.

23 Aug 2007 Mukhtar Ullah

Sorry, forgot to rate it.

04 Sep 2007 Andrew .

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

01 Oct 2007 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.

06 Jan 2010 Narasinha Parasnis  
26 Aug 2010 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?

01 Sep 2010 Kelly Kearney

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?

03 Mar 2011 Geoffrey

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.

Please login to add a comment or rating.
Updates
02 Mar 2009

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

04 Jun 2009

Fixed erroneous behavior when axes are logarithmically scaled

30 Jun 2009

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

Tag Activity for this File
Tag Applied By Date/Time
annotation Kelly Kearney 22 Oct 2008 09:23:38
customization Kelly Kearney 22 Oct 2008 09:23:38
tick Kelly Kearney 22 Oct 2008 09:23:38
label Kelly Kearney 22 Oct 2008 09:23:38
rotate Kelly Kearney 22 Oct 2008 09:23:39
text Kelly Kearney 22 Oct 2008 09:23:39
graphics Kelly Kearney 22 Oct 2008 09:23:39

Contact us at files@mathworks.com