7
$\begingroup$

How can I make the top labels on the plot below vertical so they can be read and not overlap each other?

The code I used to create the plot is:

indexnames2 = {05730, Q2774, 05453, 27202, 03689, 27367, 09747, 14922,
    54785, 07884, 02659, 06749, 08731};
ticks2 = Transpose[{Range[Length[indexnames2]], indexnames2}];
MatrixPlot[outtabletoprint, ColorFunction -> "TemperatureMap", 
 FrameTicks -> {ticks2, None, None, ticks2}, 
 PlotLegends -> Automatic, RotateLabel -> True, 
 PlotLabel -> Style[seqgroupname, FontSize -> 18]]

enter image description here

$\endgroup$
2
  • $\begingroup$ Try ticks=Table[{i, Rotate[i,Pi/4]},{i,1,num}] $\endgroup$
    – Rom38
    Commented Apr 15, 2020 at 12:54
  • $\begingroup$ @Rom38 That removed all of my tick marks. I have edited my question to show how my labels are set. $\endgroup$
    – Jamie
    Commented Apr 15, 2020 at 13:05

1 Answer 1

9
$\begingroup$
outtabletoprint = RandomReal[1, {13, 13}];

MatrixPlot[outtabletoprint, ColorFunction -> "TemperatureMap", 
 FrameTicks -> {ticks2, None, None, MapAt[Rotate[#, 90 Degree] &, ticks2, {All, 2}]}, 
 PlotLegends -> Automatic]

enter image description here

$\endgroup$
2
  • $\begingroup$ Works great. Thanks! $\endgroup$
    – Jamie
    Commented Apr 15, 2020 at 14:06
  • $\begingroup$ @Jamie, my pleasure. Thank you for the accept. $\endgroup$
    – kglr
    Commented Apr 15, 2020 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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