Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm working on a Dynamic ListPlot with a few thousand plots, and it seems that wrapping the points with Tooltip slows the Dynamic responsiveness substantially. With the simple example below, dragging the Slider is sluggish. If you change the Show line from "plot1" to "plot2", the Slider response is smooth. Notice that the ListPlot and Tooltips are not being modified by the Control. Maybe Show is muddling things when it combines the graphics, but still, the slowdown doesn't make sense to me, since Tooltip isn't active during the drag, and isn't changing in any way.

x = Table[RandomVariate[NormalDistribution[0, .5], 2], {i, 5000}];
boxPts[x_] := {{x, x}, {-x, x}, {-x, -x}, {x, -x}};
plot1 = ListPlot[MapIndexed[Tooltip[#1, First[#2]] &, x]];
plot2 = ListPlot[x];
Control[{{z, .5}, 0, 1.5}]
overlay = Graphics[{Opacity[.2],
    FilledCurve[{{Line[boxPts[1.5]]}, {Dynamic[Line[boxPts[z]]]}}]}];
Show[overlay, plot1, PlotRange -> 1.5, AspectRatio -> 1]

Output of above code

I'd prefer to be able to use Tooltip, if it's fixable, or at least understand why it's so slow. I'd also be interested in any alternative methods for doing mouseover-style feedback, which could show up inside or outside the plot area. Thank you!

(This is in Mma 9.0.1 on OSX 10.8.5, on a 2012 MBP.)

Update: I noticed that if I execute the Control line after the Show line with plot1, the Slider works smoothly. I then noticed that merely moving the cursor away to a new point can make the Control work normally. This only makes a difference with the plot that has Tooltips, since the other is always smooth.

share|improve this question
2  
you haven't defined boxPts so this cannot be tested. –  Mike Honeychurch May 19 at 4:32
    
Thanks, fixed it! Less thanks to whoever downvoted it. I did research it, and attempted to make it useful and clear. –  Joe Fusion May 19 at 4:54
    
I do not see it slowing down so much on my end. M 9.01, windows 7. Yes, the slider is tiny bit less smooth, but you have one plot with 5000 tooltips and another without? –  Nasser May 19 at 5:54
    
Mma 9.0.1 Mac 10.9.2 worked fine for me. I think you need to tell us what version of the operating system you are using. –  Mike Honeychurch May 19 at 6:00
1  
This is on 10.8.5, on a 2012 MBP. It appears to be a frontend UI quirk, based on the Update I added above. Having the cursor (text entry focus) next to the Tooltip'd output is slow. Move the cursor, or remove the Tooltips, and it's not slow. I don't think it's merely the number of objects (as @Nasser said), since I can move the cursor and see improvement, or have many more objects with Tooltips. For anyone not seeing the problem, you might try cranking up the number of points, to account for differences in hardware speed. –  Joe Fusion May 19 at 16:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.