2
$\begingroup$

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?

$\endgroup$
6
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ I was unable to upvote this due to my low user score, but this helped a lot! Thanks! $\endgroup$ – Justin Jan 29 '14 at 4:38
  • $\begingroup$ 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. $\endgroup$ – Aky Jan 29 '14 at 6:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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