# Choppy curves with Manipulate [duplicate]

While manipulating the slider in Manipulate[], I experience choppy curves. These do however render correctly after letting go of the slider. The same phenomenon occurs when pressing the + or - button or play-button.

An example of this is shown below.

The question is of course how to avoid this. Any suggestions?

Manipulate[
Plot[Sin[x] + Sin[a x], {x, 0, 10},
PlotStyle -> Thickness[0.002]], {{a, 10}, 1, 100, 1}]


Plot while holding the slider:

After some seconds a smooth plot is presented:

EDIT: Applying PerformanceGoal -> "Quality" suggested by kguler solves this problem, however some gaps appear at certain values, see below:

## marked as duplicate by Kuba♦, Simon Woods, RunnyKine, Sjoerd C. de Vries, m_goldbergSep 16 '14 at 20:14

• Closely related: 45858 and probably a duplicate – Kuba Sep 16 '14 at 19:25
• @Kuba, yes you are correct. However in spite of searching a good while before posting, I didn't find them. How did you find them so fast? – MathLind Sep 16 '14 at 20:22
• I knew what to look for so don't blame yourself :) – Kuba Sep 16 '14 at 20:46
• Regarding the second problem you can use ControlActive to specify sufficiently high PlotPoints. Please see these for an understanding of the problem: (4572183), (29346) Also my own answer to: (8482) – Mr.Wizard Sep 17 '14 at 14:25
• @Mr.Wizard, Thank you for the highly instructive links. Again, I'm amazed how you find these links. – MathLind Sep 17 '14 at 14:37

Use the option PerformanceGoal->"Quality":

Manipulate[
Plot[Sin[x] + Sin[a x], {x, 0, 10}, PlotStyle -> Thickness[0.002],
PerformanceGoal -> "Quality"], {{a, 10}, 1, 100, 1}]


From the docs:

PerformanceGoal > Details

The typical default setting for PerformanceGoal is $PerformanceGoal. \$PerformanceGoal > Details

The typical default value of \$PerformanceGoal is ControlActive["Speed","Quality"].

• This solves the issue. But if I set "a" to 89 in your example, I get a big gap around 1<x<1.25 at least on my screen. Do you experience this as well? – MathLind Sep 16 '14 at 19:28
• @MathLind, yes i see the same gap (version 9.0.1.0 Windows 8 64bit). See also a=53. Setting PlotPoints and MaxRecursion very high (e.g., PlotPoints -> 200, MaxRecursion -> 15)seems to get rid of such gaps -- at the cost of speed, of course. – kglr Sep 16 '14 at 19:36
• PlotPoints -> 200, MaxRecursion -> 5seems to suffice on my system. The lagging is bearable. – MathLind Sep 16 '14 at 19:58

You can use PlotPoints adaptively so to calculate one point per period (aprox)

Manipulate[
Plot[Sin[x] + Sin[a x], {x, 0, 10}, PlotStyle -> Thickness[0.002],
PlotPoints -> IntegerPart[10  a/2 Pi] ], {{a, 10}, 1, 100, 1}]