3
$\begingroup$

Consider the following example:

labels = Transpose@{Range@4, {"a", "b", "c", "d"}};
ArrayPlot[RandomInteger[1, {4, 4}],
 Mesh -> True, Frame -> True, PlotRangePadding -> None,
 FrameTicks -> {{labels, labels}, {labels, labels}}]

enter image description here

I want to eliminate the tick marks (the little lines that appear with the row/column labels), but retain the labels (a, b, etc.). Using FrameTicks->None removes the tick marks, but also removes the labels, so it's not what I want.

How can I do this?

$\endgroup$
  • $\begingroup$ if you want to keep ticks in the white cells you make add FrameTicksStyle -> Directive[Black], FrameStyle -> Directive[Black] $\endgroup$ – Algohi Dec 11 '14 at 16:17
4
$\begingroup$

Look for details on "Ticks" in help, each tick can be defined by {x, label, len, style} - len defines the outer and inner length of the tick, so in your case just add 0 to each tick specs:

labels = Transpose@{Range@4, {"a", "b", "c", "d"}, 0 Range[4]};

and here you go:

enter image description here

$\endgroup$
4
$\begingroup$

you can use Method -> {"FrameInFront" -> False}] option.

labels = Transpose@{Range@4, {"a", "b", "c", "d"}}; 
ArrayPlot[RandomInteger[1, {4, 4}], Mesh -> True, Frame -> True, 
 PlotRangePadding -> None, 
 FrameTicks -> {{labels, labels}, {labels, labels}}, 
 Method -> {"FrameInFront" -> False}]

enter image description here

$\endgroup$
  • $\begingroup$ Nice trick! Never heard of such method and can't find it in docs... anyway thanks for a nice new approach! $\endgroup$ – funnyp0ny Dec 11 '14 at 23:37
  • $\begingroup$ @funnypony 32231 $\endgroup$ – Kuba Dec 12 '14 at 7:23

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