Hot answers tagged

16

Preface: This issue seems to appear solely on Linux. For me, a reliable way to reproduce it is to do the following: Create this plot wich contains an invalid Epilog data = RandomReal[1, {100, 2}]; ListPlot[data, Epilog -> Table[Point[], {20}]] You get the plot with is red, and when you hover with the mouse over the area, you get the normal tooltip ...


12

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


11

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


9

This is because the elements of wordsWithTooltips aren't strings. If you convert to strings, there's no issue. StringReplace[txt, #1 -> ToString[#2, TraditionalForm] & @@@ tls]


9

From the version 12.1 on, you can use option ItemDisplayOption -> (# &). By default, it is set to Automatic, which does some preprocessing and converts large items to ellipsis. tooltipValue = Plot[Sinc[x], {x, 0, 10}]; Dataset[{<|"colA" -> 1, "colB" -> Tooltip[1, tooltipValue]|>, <| "colA" -> 2, &...


8

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


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


8

Adding the option LabelingFunction -> Tooltip fixes the problem. If the number of bins exceeds 25, LabelingFunction option value is set to None. You can see the code behind Charting`iHistogram (which is called by Histogram) after clearing its Protected and ReadProtected attributes. The relevant part of the code is: If[System`HistogramDump`perfgoal===...


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

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


7

You can post-process the output of DistributionChart to modify the content of tooltips: Module[{i = 1}, DistributionChart[data] /. Grid[x_, o__] :> Grid[Prepend[x, {Style["count", Bold], Length[data[[i++]]]}], o]] Alternatively, you can wrap each data set with Tooltip using the second argument to specify tooltip content: ClearAll[toolTip] toolTip = ...


7

Here's one way: stocks = {"AAPL", "FB"}; prices = FinancialData[stocks, {{2019, 11, 1}, {2019, 11, 15}}]; stockPrices = AssociationThread[stocks, prices]; tooltip[expr : {date_, value_}] := Tooltip[expr, DateString[date]] DateListPlot[ (tooltip /@ Normal[#]) & /@ stockPrices ]


7

BarChart[Tooltip[#2, {##}] & @@@ data, Axes -> True] You can also use BarChart[Tooltip[Last @ #, #] & /@ data, Axes -> True] same picture Alternatively, you can set the option value for the option ChartLabels to Placed[data, Tooltip]: BarChart[data[[All, 2]], Axes -> True, ChartLabels -> Placed[data, Tooltip]] same picture


6

This should be as simple as wrapping any one of the answers to your previous question within Tooltip. In this case, I prefer to start from Mr. Wizard's answer, because it allows me to stay away from explicitly building up the necessary Box expression. MakeBoxes[pvB[n_Integer, P_Integer, _, x__], fmt : TraditionalForm] := MakeBoxes[#, fmt] &@ Tooltip[ ...


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

Use the 3-arg version of Overlay: Overlay[{SetAlphaChannel[background, 0.2], wc}, All, 2]


6

You should generate a single tooltip for each country; Tooltip will not automatically thread over the list. Let's generate some data: SeedRandom[20200106] listOfCountries = WolframAlpha["countries world", {{"Result", 1}, "Output"}, InputAssumptions -> {"*MC.%7E-_*DataType-"}, PodStates -> {"Result__More", "Result__More"}] // ReleaseHold; ...


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


5

Quick fixes for specific cases TemplateBox has Tooltip option so we can use it. There are three ways I'm aware of: go to Core.nb stylesheet, find "Binomial" style and add Tooltip->None to its TemplateBoxOptions. or you can target specific expression, the problem is that you have to be precise because TemplateBoxOptions will be overwritten by those from ...


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

Here is what I think is going on with the second argument to ContourLabel. Everything starts with the fact that ContourPlot has Attribute of HoldAll, which means that all the options you give it can be parsed in a non-standard way before being evaluated. This seems to be happening in the ContourLabels option: it is scanned for the appearance of Tooltip, ...


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


5

You almost got it :-) It's VertexLabels -> Placed["Name", Tooltip] This usage is shown in VertexLabels -> Scope -> Label Specification.


5

I prefer avoiding TraditionalForm strings, e.g., ToString[Tooltip[x/y,stuff],TraditionalForm]//FullForm (* "\!\(\*FormBox[TagBox[TooltipBox[FractionBox[\"x\", \"y\"], \"stuff\"], Function[Annotation[Slot[1], stuff, \"Tooltip\"]]], TraditionalForm]\)" *) Instead, I would use StringForm. The simplest version would be: indices = {"`1`", "`2`", "`3`"}; ...


5

Here's a start: data = Table[{x, N@Exp[x]}, {x, 0, 3, 0.2}]; ClearAll[annotate] annotate[set_] := Map[ Mouseover[Tooltip[Point[#], #], {Point[#], Line[{{#[[1]], 0}, #}]}] &, set ] Graphics[ annotate[data], AspectRatio -> 1/GoldenRatio, Axes -> True, PlotRangePadding -> Scaled[.05] ]


5

Clear["Global`*"] Create a wrapper for adding a Tooltip to a Quantity qTooltip[q_Quantity, tt_String] := Tooltip[QuantityForm[q, "Abbreviation"], tt] Like other wrappers (e.g., MatrixForm), the wrapper should not be included in variable definitions. qTooltip[quant = Quantity[1, "Month"], "how to make it work?"] (* ...


4

The solution below seems to work for me from within ContourPlot, using the ContourLabels option: ContourPlot[ Exp[-x^2 - y^2], {x, 0, 2}, {y, 0, 2}, PlotRange -> Full, Contours -> 10^Range[-4, 0, 0.1], ContourLabels -> {None, Tooltip[#3, DisplayForm[SuperscriptBox[10, Log[10, #2]]]] &} ] The key piece of information is the fact that the g ...


4

Hat-tip to DrMajorBob for this handy workaround: ContourPlot[ Exp[-x^2 - y^2] , {x, 0, 2}, {y, 0, 2} , PlotRange -> Full , Contours -> 10^Range[-4, 0, 0.1] ] /. {Tooltip[expr_, tooltip_] :> Tooltip[expr, DisplayForm[SuperscriptBox[10, Log[10, tooltip]]] ]} This uses the fact that Tooltip'd expressions have a very ...


4

In version 7 this suppresses the Show Animation Controls tooltip but fails to suppress the Play, Step Forward etc. ones. Style[ Manipulate[Plot[Sin[x (1 + a x)], {x, 0, 6}], {a, 0, 2}], TooltipBoxOptions -> {DefaultLabelStyle -> {Opacity[0], 0}} ]


4

Add a dummy graphic to each mesh line with the appropriate tooltip label and combine them via post-processing: ParametricPlot[{u Cos[v], u Sin[v]}, {u, 1, 2}, {v, 0, Pi/2}, Mesh -> { Table[{u, Tooltip[Null, u]}, {u, 1, 2, 0.25}], Table[{v, Tooltip[Null, v]}, {v, 0, Pi/2, Pi/12}]} ] /. {g___, Tooltip[_, label_], l__Line} :> {g, Tooltip[{l}, ...


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