Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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

1 Answer 1

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}}]

MatixPlot

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 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 at 6:07

Your Answer

 
discard

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.