# How can I combine 2D slider with MatrixPlot? [duplicate]

If I enter MatrixPlot[{{1, 2}, {3, 4}}]，it shows:

How can I combine this with a 2D slider，when I move the slider to a region，it could show me the value that correspond to the matrix?

• See the answers here – Jason B. Aug 12 '16 at 18:18
• By "slider", do you actually mean "tooltip"? – J. M.'s technical difficulties Aug 12 '16 at 18:26
• @J.M. - I actually like faleichik's Dynamic version in the linked post (duplicate?) better than the Tooltip-based accepted answer – Jason B. Aug 12 '16 at 18:45
• I think it's a dupe, @Jason, but I'll let other people vote... and yes, faleichik's solution is lovely. – J. M.'s technical difficulties Aug 12 '16 at 18:46
• I hadn't seen the first comment, excuse me. – BoLe Aug 12 '16 at 18:48

By "slider", do you mean locator?

m = RandomInteger[{1, 100}, {10, 10}];

With[{eps = .1},
DynamicModule[{p = {.5, .5}, lab},
lab[{x_Integer, y_Integer}] :=
Style[StringJoin[{"value: ",
ToString[m[[Length[m] - y, x + 1]]]}], 16, Bold];
LocatorPane[
Dynamic[p],
MatrixPlot[m,
PlotLabel -> Dynamic[lab@Floor@p]],
{{eps, eps}, Dimensions[m] - eps}]]]


• That's exactly what I want! Amazing! Thank you very much. – 蔡漢倫 Aug 13 '16 at 0:01