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?
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityBy "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}]]]
Dynamic
version in the linked post (duplicate?) better than theTooltip
-based accepted answer $\endgroup$