Hot answers tagged

18

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 ...


16

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]], ...


13

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 -...


12

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? labelingfunc[{...


11

Here's a quick fix: DiscretePlot[ Tooltip[PDF[PoissonDistribution[10], x]] , {x, 0, 20}] /. Tooltip[a_, b_] :> Map[Tooltip[Point[#], Last@#] &, a[[3, 1]]] If you investigate under the hood, Cases[ ListPlot[Table[Tooltip[PDF[PoissonDistribution[10], x]], {x, 0, 1}]] , Tooltip[a__] :> {a} , Infinity] (* { {{Opacity[0.], Point[{{1., 0....


10

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 ...


10

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 ...


8

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 -> ...


8

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

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 @ ...


8

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]


8

This is a very common problem for people who work on data analysis. Here as a solution to the problem using LocatorPane and a few other functions and tricks. TooltipListPlot[data_, tipFunction_, listPlotOptions___] := DynamicModule[ {displayQ = False, yRange , xRange, pt, minX, maxX, minY, maxY, tip, threshold, tipPosition, nf, dataPoints, ...


7

I tracked this down a few years ago. Around version 6 or 7 I was writing a function to put a legend on a plot based on the Tooltip wrapped around each data set. It worked on all plots except ListPlot. Back then some of the graphing functions were in an external package instead of built-in, so I could open the package and look at the code. Apparently, for ...


7

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] ]


7

THIS IS NOT AN ANSWER BUT RATHER AN EXTENDED COMMENT. Your ListPlot example is shifted from the proper location since the data is assumed to start with 1 rather than 0. To correct this, you can either enter data points or specify the DataRange. You can use the option Filling->Axis to get the same format as you would with DiscretePlot. ListPlot[ Tooltip[...


6

Graph[{1, 2, Tooltip[3, "Label"]}, {1 \[UndirectedEdge] 2, 2 \[UndirectedEdge] 3, 3 \[UndirectedEdge] 1}]


6

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, {...


6

It's a bug. Wolfram is aware of it but has not chosen to fix it. Sometimes I restart Mathematica to deal with it. If I am running something, for example, in a Manipulate function, I clear the local variables every time it is run. This helps most of the time. Jeff


6

It seems to me you just need to add Thread: ListLogPlot[Thread @ Tooltip[data, samp], Joined -> True]


6

For illustrative purposes: dt = DateRange[{2014, 1, 1}, {2014, 1, 31}]; v = RandomInteger[{5, 10}, 31]; dat = Transpose[{dt, v}]; tt = Tooltip[#, Row[{DateString[ First@#, {"DayNameShort", ", ", "Day", " ", "MonthNameShort", " ", "Year"}], ": ", Style[Last@#, Red, Bold]}], TooltipStyle -> {Background -> White, ...


6

data = Sort@RandomInteger[10, {10, 2}]; tts = {Directive[Red, 16, Bold], CellFrame -> 3, CellFrameMargins -> 5}; ListPlot[MapIndexed[Tooltip[#, First@#2, TooltipStyle -> tts] &, data], PlotStyle -> PointSize[Large], Frame -> True, AxesOrigin -> {0, 0}]


5

data = { {2776.37, 2016.64, 1483.51, 1027.35, 500.878, 94.1385, 310.402, 282.548, 257.886, 224.359, 218.688, 209.312, 215.776, 198.78}, {40.5063, 24.633, 12.069, 8.3151, 6.35135, 15.0977, 8.74372, 15.5125, 9.34959, 9.70696, 11.125, 12.1457, 10.8075, 9.7561}, {113.08, 124.633, 75.9698, 59.5186, 55.9459, 7.81528, 57.4372, ...


5

What you need is: DisplayData20YrNoScientific = Map[Tooltip[#, NumberForm[N[#], ExponentFunction -> (Null &)]] &, DisplayData20Yr] So check that the tooltip works ok on the data: Then plot it: ListLinePlot[DisplayData20YrNoScientific, Joined -> True, PlotMarkers -> {Automatic, 12}] Edit Forgot to mention that your original ...


5

EDIT As rasher observes my answer does not answer your direct question. Tooltip wrapper does not appear to work for ListPicker items. I posted this answer in the event it achieves your aim or motivates your own answer. I am not certain what your ultimate aim is. I have modified your code (esp. avoid uppercase variable names to avoid conflicts with in-...


5

Not sure why it isn't default but you have to put in a TooltipStyle: Magnification -> FrontEnd`AbsoluteCurrentValue[ EvaluationNotebook[], Magnification] FrontEnd` context is needed since it won't evaluate earlier and will be dynamically adjusted. Tooltip[ Plot[Sin[x], {x, -2 π, 2 π}], Column[{ Dynamic@CurrentValue@Magnification, Plot[...


5

We have to use Is there a GraphicsPrimitiveQ (or a complete list of Heads of graphics primitives)? primitivesQ = MatchQ[#, Alternatives @@ {Point, PointBox, Line, LineBox, Arrow, ArrowBox, Rectangle, RectangleBox, Parallelogram, Triangle, JoinedCurve, JoinedCurveBox, FilledCurve, FilledCurveBox, StadiumShape, DiskSegment, ...


4

The answer in general is no, and I've also wished there was a simple way to do it. The only exception I know of is when you export a notebook with a ContoutPlot or ListContourPlot to HTML, as in this question. The exported GIF image actually contains a reference to an image map which is a very old-fashioned way of providing tooltip information in images ...


4

You can insert the value into the tooltip using ToString: Manipulate[ Plot[Tooltip[Sin[k x], "Sine Curve, k=" <> ToString[k]], {x, 0, 4 \[Pi]}], {k, 1, 5}]


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.


4

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[{ ...



Only top voted, non community-wiki answers of a minimum length are eligible