Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #7988 > unrolled thread

missing Tooltip for ArrayPlot etc. - workaround

Started bysibir <martin.rommel@gmail.com>
First post2012-01-19 10:12 +0000
Last post2012-01-19 10:12 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  missing Tooltip for ArrayPlot etc. - workaround sibir <martin.rommel@gmail.com> - 2012-01-19 10:12 +0000

#7988 — missing Tooltip for ArrayPlot etc. - workaround

Fromsibir <martin.rommel@gmail.com>
Date2012-01-19 10:12 +0000
Subjectmissing Tooltip for ArrayPlot etc. - workaround
Message-ID<jf8qa2$3k1$1@smc.vnet.net>
People on the group have occasionally bemoaned the lack of support for
Tooltip with ArrayPlot and the like.
I was missing this handy functionality as well today and came up with
a workaround.
If somebody has a better solution or suggestions for improvement,
please post!
Of course, built-in support like for ListPlot would be the best.

Note, that my example below suffers from a lack of range checking for
the array indices. I minimize it by not having any PlotRangePadding,
but you can still get an error if you move the mouse pointer slowly
over the top or right edge. (I'm using 8.0.4.0 on Windows, 64 bit)

With[{a = Table[i + Sin[i^2 + j^2], {i, 0, 4, .1}, {j, 0, 4, .1}]},
 Dynamic@Tooltip[
   ArrayPlot[a, ColorFunction -> "SunsetColors", PlotRangePadding ->
None],
   a[[Sequence @@With[{pt =IntegerPart /@ MousePosition["Graphics",
{0, 0}]}, {Length[a] - pt[[2]], 1 + pt[[1]]}]]]
 ]
]

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web