# Frame ticks of array plot given by a list

Suppose I have an array plot like this:

M = RandomReal[1, {5, 10}];

ArrayPlot[M, FrameTicks -> Automatic] How can I make it so that the frame ticks are given by a list, like:


x={2,4,6,8,10,12,14,16,18,20};

y={10,11,12,13,14};



SeedRandom
M = RandomReal[1, {5, 10}];
x = {2, 4, 6, 8, 10, 12, 14, 16, 18, 20};
y = {10, 11, 12, 13, 14};

{xticks, yticks} = MapIndexed[{#2[], #} &, #] & /@ {x, y};

ArrayPlot[M, FrameTicks -> {{yticks, yticks}, {xticks, xticks}}] You can also use

{yticks2, xticks2} = Thread /@ Thread[{Range[Dimensions[M]], {y, x}}];

{yticks2, xticks2} == {yticks, xticks}

 True


Alternative approach is to reverse the rows of M and use the options DataRange and DataReversed and use {{y,y},{x,x}} as FrameTicks:

ArrayPlot[Reverse @ M,
DataReversed -> True,
DataRange -> MinMax /@ {x, y},
FrameTicks -> {{y, y}, {x, x}},
AspectRatio -> 1/2] • Image are not identical? Mar 3 at 21:39
• Thank you @OkkesDulgerci. Updated to get identical images.
– kglr
Mar 3 at 22:11