Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
Labelling ArrayPlot Charts

I am making a MatrixPlot. For example, consider the following:

list = {{1, 1, 0, 1}, {0, 0, 1, 1}, {1, 0, 1, 0}};

which yields:


But now suppose I want to label the axes with other numbers. For example, I would like to label the ticks on the horizontal axis as 101, 167, 188, 205 (as they are not now), and the ticks on the vertical axis as 1, 2, 3 (as they already are). I know this is a strange request, but it is because I would like to label the horizontal axis according to "particle number" (which is an integer in my application).

Or maybe a better way to phrase the question is, is it possible to label axis/frame ticks with any arbitrary string (for example, labeling the horizontal axis with "Alice", "Bob", "Carla", and "David")? One possibility seems like FrameTicks, but I can't seem to figure out if it can be used to map strings.

If I use

list = {{1, 1, 0, 1}, {0, 0, 1, 1}, {1, 0, 1, 0}};
 FrameTicks -> {{{1, 2, 3}, None}, {{101, 167, 188, 205}, None}}]

I get:


because, of course, FrameTicks thinks I'm referring to which discrete values to label.

Also, if I try:

list = {{1, 1, 0, 1}, {0, 0, 1, 1}, {1, 0, 1, 0}};
 FrameTicks -> {{{1, 2, 3}, None}, {{"101", "167", "188", "205"}, 

I get "Not a valid tick specification."

Do you have any other ideas?

share|improve this question

marked as duplicate by R. M., Mr.Wizard Jun 9 '12 at 3:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

I believe this was covered in…. – DavidC Jun 8 '12 at 16:11
This doesn't work because the frame ticks specification needs positions to determine where to place the labels. If you use numbers mma assumes positions == labels, and with the high values you're using they are out of the plot range. In the case of the strings as labels there is no position information at all. – Sjoerd C. de Vries Jun 8 '12 at 17:39
This question is about something qualitatively different than the above-referenced question. FDSg's answer below is correct, and this should not be marked as a duplicate. – Steven Bedrick Nov 6 '13 at 0:19
@StevenBedrick Can we change it from not duplicate to duplicate? This question was directly useful to me where as the other answer was not. – olliepower Jun 15 '15 at 21:11
up vote 16 down vote accepted

try this

 FrameTicks -> {
 {{1, 2, 3}, None}, {{{1, 101}, {2, 167}, {3, 188}, {4, 205}}, {{1, "Alice"}, {2,"Bob"}}}

enter image description here

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.