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

I'm using the following to label a MatrixPlot:

FrameTicks -> {{yticks, None}, {None, xticks}},

I'm labeling these ticks with text. It is impossible to get the graph to a reasonable size while maintaining legibility of the text all on a single axis.

So what I'm attempting to do is sub-divide my label list, alternating the label that goes to one of two tick expressions:

FrameTicks -> {{leftyticks, rightyticks}, {None, xticks}},

But I have no idea how to do that. As of right now I am sorting the labels alternatively by hand and pasting them in to 'leftyticks' and 'rightyticks'. There has got to be a faster way to drag a list from a file, split it in alternating sequence, and dump the products in to the two tick-label groups, right?

share|improve this question

Assuming I've understood your question correctly, something like this will work:

labels = CharacterRange["a", "z"]; (* fake labels a, b, .. z *)
yticks = MapIndexed[{First@#2, #1} &, labels]; (* {{1, a}, {2, b}, ..} *)

leftyticks = yticks[[1 ;; -1 ;; 2]];
rightyticks = yticks[[2 ;; -1 ;; 2]];
MatrixPlot[RandomReal[1, {26, 26}], 
 FrameTicks -> {{leftyticks, rightyticks}, {None, None}}]


The main thing to note is that the yticks list has the form {{y1, label1},{y2, label2}, ..}. See the documentation for Ticks.

share|improve this answer
I was unable to upvote this due to my low user score, but this helped a lot! Thanks! – Justin Jan 29 '14 at 4:38
No worries.. you might be able to accept the answer though (if this solves your problem) by clicking on the check-mark below the votes counter. – Aky Jan 29 '14 at 6:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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