Hot answers tagged tooltip
15
ListPlot accepts data wrappers besides Tooltip
(although I could not find any mention of this feature in the docs).
So, @Jens' method can be achieved without post-processing:
data = Table[{Sin[n], Sin[2 n]}, {n, 50}];
ListPlot[PopupWindow[Tooltip[#], #] & /@ data]
On mouseover:
Click on a point:
Note: Thought this was a new feature added ...
13
My variant is without tooltips but is fast. You need to click on the desired cell to get the value. One more advantage is that you have the generic MatrixPlot, not a substitute.
A = Table[Sin[x y/10 + x], {x, 1, 50}, {y, 1, 50}] // N;
{n, m} = Dimensions@A;
DynamicModule[{pt = {1, 1}/2, trans, ij},
trans[{x_, y_}] := {Max[1, Min[n, Floor[n - y] + 1]],
...
11
Actually, as we can use Tooltip on elements directly this is a cleaner method:
label =
Tooltip[{##2},
Grid[{
{"Name", #},
{"Usability ", #2},
{"Relevancy", #3},
{"Market Size", #4}
}, Frame -> All, Alignment -> Left
]] &;
BubbleChart[
label @@@ data3,
ChartStyle -> 24
]
How about this?
...
10
This is just an elaboration of faleichik's answer. To create a MatrixPlot with tooltip labelling and highlighting of the selected square similar to for example BarChart or BubbleChart you could do something like
matPlot[mat_, opts : OptionsPattern[]] :=
With[{dim = Dimensions[mat]},
DynamicModule[{pt = {0, 0}, ij, xy, label, direction},
direction = 1 ...
9
Improvised Tooltip using Text and Mouseover
Here's one way to improvise a tooltip for graphics objects--in this case,
a list of points. It emulates a tooltip but does not leave a a drop shadow, and as István notes, has a few graphical shortcomings that make it less than ideal (clipping, under axes layer). Also, the code would need to be tweaked for objects ...
9
My colleague John Fultz suggested the following answer.
f /: MakeBoxes[dat : f[args_], fmt_] :=
TagBox[ToBoxes[Rasterize@RandomImage[1, {100, 100}]],
InterpretTemplate[f[args] &], Editable -> False, Selectable -> True,
SelectWithContents -> True, Tooltip -> "tooltip"]
After a bit of exploring I realized that I should have checked ...
8
The answer by Mr. Wizard covers the built-in options, but one thing that you may be missing is that the tooltip alone isn't very convenient when it comes to recording the desired coordinates for later use. You'd have to read off the numbers and type them in again.
If you want to automate this process too, then you might be interested in the following:
data ...
7
Inspired by Jens' answer, here is a method that will print below the plot the coordinates of each point clicked.
printTip = Button[Tooltip@##,
SelectionMove[ButtonNotebook[], After, Cell];
NotebookWrite[ButtonNotebook[], ToBoxes@#2],
Appearance -> "Frameless"] &;
data = N @ Table[{Sin[n], Sin[2 n]}, {n, 50}];
ListPlot[Tooltip @ ...
7
You can also explicitly label using VertexLabels and use Tooltip as the positioning:
Graph[{1 -> 2, 1 -> 3, 1 -> 4, 1 -> 5},
VertexLabels -> {5 -> Placed["five", Tooltip]}, ImagePadding -> 20]
6
Show[
ListPlot3D[correlationMatrix,
AxesStyle -> Thickness[0.01],
AxesLabel -> {"X", "Y", "Corr(X,Y)"},
AxesEdge -> {{-1, -1}, {-1, -1}, {-1, -1}},
ColorFunction -> "BrightBands"],
ListPointPlot3D @ Tooltip @ Flatten[
MapIndexed[Flatten@{#2, #1} &, correlationMatrix, {2}], 1]
]
6
EDIT: y-axis corrected
You could do something like this:
a = RandomInteger[99, {7, 5}];
minmax = {Min@a, Max@a};
cf = ColorData["SunsetColors"];
ticks = Table[{i, # - i + 1}, {i, #}] & @ Length[a]
Graphics[
{cf[1 - Rescale[#2, minmax]],
Tooltip[Rectangle[# - 0.5], #2]} & @@@
Most @ ArrayRules @ Reverse[a\[Transpose], {2}],
Frame -> ...
5
One can also use the option CoordinatesToolOptions for MatrixPlot and make use of the Get Coordinates tool as follows:
MatrixPlot[mat, ColorFunction -> "DeepSeaColors",
CoordinatesToolOptions ->
{"DisplayFunction" ->
Function[pt,
With[{rows = Dimensions[mat][[1]], columns = Dimensions[mat][[2]]},
indices = {Clip[Floor[rows - pt[[2]]] + 1, ...
4
One way to do this:
is = 150; rm = RandomInteger[100, {5, 5}]; m = Map[Tooltip[#, #] &, rm, {2}];
A = GraphicsGrid[m, ImageSize -> is {1, 1}]; B = MatrixPlot[rm, FrameTicks -> None,
Mesh -> All, PlotRangePadding -> 0, ImageSize -> is {1, 1}]; Overlay[{A, B}, All, 1]
It'll be a bit more elaborate to add frame ticks.
3
String manipulation like in jVincent's answer is nice, but I normally prefer to combine these types of elements using Row:
Manipulate[
Plot[Tooltip[Sin[k x], Row[{"Sine Curve, k=", k}]], {x, 0, 4 Pi}],
{k, 1, 5}]
For more complicated objects, it just normally ends up being neater. Maybe my preference comes from having to work with RowBox and ...
1
With[{
top = 0.5 RandomReal[{0, 1}, 100] + Table[Sin[0.0628 i], {i, 100}],
bot = 0.5 RandomReal[{0, 1}, 100] + Table[Cos[0.0628 i], {i, 100}],
opts = {Joined -> True, ImageSize -> 400}
},
With[{epi = Function[{}, With[
{mouse = MousePosition[{"Graphics", Graphics}, {99999, 99999}]},
Text[Style[Framed[Column[{
...
1
Some time ago I wanted to have good tooltips for images composed by polygons. Mathematica generated square areas only, and the polygons had many shapes. Then I did my own export function for polygons with tooltips. I basicaly rescaled all the polygon points to the image size and wrote the image maps. I never found how to get the right area from Mathematica. ...
Only top voted, non community-wiki answers of a minimum length are eligible

